Card has to be powered on for a second time

[ Follow Ups ] [ BasicCard User Forum ]

Posted by nickl ( on November 21, 2006 at 14:33:44:

I am using a card in an ACS ACR88 reader. I am making calls to &H8010 and then &H8020 (comments etc removed for brevity). Both calls work as expected, but only if I perform a card power-on (reset) between the two calls.

I would welcome some advice on what I am doing wrong, as this does not seem right. Basic code first, then the script from the ACR88.

Thanks, Nick

#pragma ATR(T=1)
Type AA10
lngRestaurantNumber as long
strRestaurantName as string*20
lngBalance as long
End Type
Eeprom strRestaurantName as string*20 = left$("Smiles" + space$(20), 20)
Command &H80 &H10 GetRestaurantName (strName as string*20)
strName = strRestaurantName
End Command
Command &H80 &H20 CheckBalanceRecord (objAA10 as AA10)
' A stub for now
SW1SW2 = &H6B03
End Command


// Get restaurant name
APDU_Error_Exit(0x02, 0x80, 0x10, 0x00, 0x00, 0x00, 22, hexResponseAPDU, bytCardStatus, labelRestaurantCardErrorStatus);
Byte_Not_Equal(hexResponseAPDU[20], 0x61, labelRestaurantCardErrorAPDU); // 6114 for 20 bytes returned
Byte_Not_Equal(hexResponseAPDU[21], 0x14, labelRestaurantCardErrorAPDU);
RAM_Copy(strRestaurantName, hexResponseAPDU, 20);

CardPower(0x02, 0x01, bytCardStatus); // Power on. Fails without this(

// Pass data to Restaurant Card
Set_RAM(hexRequestAPDU, 5, 0x80, 0x20, 0x00, 0x00, 28);
RAM_Copy(hexRequestAPDU[5], hexResponseAPDU, 28);
APDU_Error_Exit_RAM(0x02, hexRequestAPDU, 33, 0x02, hexResponseAPDU, bytCardStatus, labelRestaurantCardErrorStatus);

Follow Ups:

[ Follow Ups ] [ BasicCard User Forum ]