
The example application performs transactions involving two ACOS3 smart cards (a SAM and SIM card), and
demonstrates the DS8005’s ability to communicate with two cards in a mutually exclusive fashion. The
application simulates a situation where a SIM card remains in place once inserted, while it waits for a SAM
card to be inserted.
Initially, the application waits until either pushbutton SW4 is pressed (for communication with the SIM card) or
a SAM card is inserted into the smart-card socket. The first time SW4 is pressed, the application will power up
the card and issue an Answer to Reset (ATR) to the SIM card. If this is successful, the application will perform
basic credit and debit transactions, along with a smart card initialization function based on user input from the
pushbuttons. When a SAM card is inserted, the application halts communication with the SIM card (but retains
power to the card) and performs an ATR on the SAM card. Again, if the ATR is successful, it performs basic
credit and debit transactions and a smart-card initialization function until the SAM card is removed. Once the
SAM card is removed, the application goes back to waiting until either SW4 is pressed or another SAM card is
inserted. If SW4 is not pressed for the first time (i.e., the application has already performed an ATR on the
SIM card), it will assume the SIM card is still present and resume communication with it, bypassing the ATR
step as it is only necessary at card power-up. If the SIM card is removed after it has already been properly
powered up, the next time the application tries to communicate with it, an error will occur, and it will power
down the SIM card and return to waiting for SW4 or SAM card insertion. Now, if SW4 is pressed, and the SIM
card is properly inserted back into the SIM card socket, the application will power-up the SIM card and issue
another ATR.
The LCD screen acts as the main user interface, providing instructions on how to proceed and perform basic
functions on the two smart cards, while the serial port gives additional information as to what is going on
behind the scenes.
The three LEDs act as visual indicators of what is going on in the application as well. The green LED indicates
that the application is running. The orange (top) LED indicates that the application is currently communicating
with the inserted SAM card. The red (middle) LED indicates that the application is currently communicating
with the SIM card.
Smart Card Transactions
The smart card reader (
) properly manages the sending and receiving of application protocol data
units (APDUs), as defined in the EMV specifications, to the ACOS3 smart cards supplied in the DS8005-KIT.
This is used to demonstrate typical payment transactions. The four transactions implemented in the example
code are:
1. A debit transaction, where $10 is deducted from the card’s balance
2. A credit transaction, where $10 is added to the card’s balance
3. A card-initialization transaction, where the card’s balance and transaction count are set to $100 and 0,
respectively
4. A check-balance transaction, where the card’s balance and transaction count are read from the card
EMV is a registered certification mark owned by EMVCo, LLC. (See
IAR Embedded Workbench is a registered trademark of IAR Systems AB.
Windows is a registered trademark and registered service mark of Microsoft Corporation.
Windows Vista is a registered trademark and registered service mark of Microsoft Corporation.
Windows XP is a registered trademark and registered service mark of Microsoft Corporation.
Page 21 of 22