ACS ACR122T Operating instructions

www.acs.com.hk
Application Programming Interface V2.02
ACR122T
USB Token
NFC Reader

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 2 of 45
Table of Contents
1.0. Introduction ............................................................................................................... 4
1.1. Features.................................................................................................................................4
1.2. USB Interface ........................................................................................................................5
2.0. Implementation.......................................................................................................... 6
2.1. Communication Flow Chart of ACR122T ..............................................................................6
2.2. Smart Card Reader Interface Overview ................................................................................7
3.0. PICC Interface Description....................................................................................... 8
3.1. ATR Generation.....................................................................................................................8
3.1.1. ATR Format for ISO 14443 Part 3 PICCs.....................................................................8
3.1.2. ATR Format for ISO 14443 Part 4 PICCs.....................................................................9
4.0. PICC Commands for General Purposes................................................................ 11
4.1. Get Data...............................................................................................................................11
5.0. PICC Commands (T=CL Emulation) for Mifare Classic Memory Cards ............. 12
5.1. Load Authentication Keys....................................................................................................12
5.2. Authentication ......................................................................................................................13
5.3. Read Binary Blocks .............................................................................................................16
5.4. Update Binary Blocks ..........................................................................................................17
5.5. Value Block Related Commands.........................................................................................18
5.5.1. Value Block Operation ................................................................................................18
5.5.2. Read Value Block........................................................................................................19
5.5.3. Restore Value Block....................................................................................................19
6.0. Pseudo APDUs ........................................................................................................ 21
6.1. Direct Transmit ....................................................................................................................21
6.2. Bi-color LED and Buzzer Control.........................................................................................22
6.3. Get the Firmware Version of the Reader.............................................................................24
6.4. Get the PICC Operating Parameter.....................................................................................25
6.5. Set the PICC Operating Parameter .....................................................................................26
7.0. Basic Program Flow for Contactless Applications.............................................. 27
7.1. How to Access PC/SC-compliant Tags (ISO 14443-4)? .....................................................28
7.2. How to Access DESFire Tags (ISO 14443-4)? ...................................................................29
7.3. How to Access FeliCa Tags (ISO 18092)?..........................................................................30
7.4. How to Access NFC Forum Type 1 Tags (ISO 18092), e.g. Jewel and Topaz Tags?........31
7.5. Getting the Current Setting of the Contactless Interface.....................................................33
Appendix A. ACR122T PC/SC Escape Command ......................................................... 34
Appendix B. APDU Command and Response Flow for ISO 14443-compliant Tags .. 37
Appendix C. APDU Command and Response Flow for ISO 18092-compliant Tags .. 38
Appendix D. Error Codes................................................................................................. 39
Appendix E. Sample Codes for Setting the LED ........................................................... 41
List of Figures
Figure 1 : Communication Flow Chart of ACR122T............................................................................... 6
Figure 2 : Smart Card Reader Interface on the Device Manager .......................................................... 7
Figure 3 : Basic Program Flow for Contactless Applications ............................................................... 27
Figure 4 : Topaz Memory Map ............................................................................................................. 32

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 3 of 45
List of Tables
Table 1 : USB Interface .......................................................................................................................... 5
Table 2 : ATR Format for ISO 14443 Part 3 PICCs ............................................................................... 8
Table 3 : ATR Format for ISO 14443 Part 4 PICCs ............................................................................... 9
Table 4 : Mifare 1K Memory Map ......................................................................................................... 14
Table 5 : Mifare 4K Memory Map ......................................................................................................... 14
Table 6 : Mifare Ultralight Memory Map ............................................................................................... 15
Table 7 : Bi-color LED and Buzzer Control Format (1 Byte) ................................................................ 22
Table 8 : Current LED State (1 Byte).................................................................................................... 23
Table 9 : PICC Operating Parameter (Default Value = FFh)................................................................ 26

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 4 of 45
1.0.Introduction
The ACR122T is an NFC contactless smart card reader/writer token used for accessing ISO 14443-4
Type A and B, Mifare, ISO 18092 or NFC, and FeliCa tags. The ACR122T is PCSC-compliant so it is
compatible with existing PCSC applications. Furthermore, the standard Microsoft CCID driver is used
to simplify driver installation.
The ACR122T serves as the intermediary device between the personal computer and the contactless
tag via USB interface. The reader carries out the command issued from the PC, whether the
command is used in order to communicate with a contactless tag or control the device peripherals.
The ACR122T uses the PCSC APDUs for contactless tags following the PCSC Specification and
makes use of pseudo APDUs in sending commands for ISO 18092 tags and controlling the device
peripherals. This document will discuss how you can use the ACR122T in your smart card system.
1.1. Features
•USB 2.0 Full Speed Interface
•CCID Compliance
•Smart Card Reader:
oRead/Write speed of up to 424 kbps
oBuilt-in antenna for contactless tag access, with card reading distance of up to 30 mm
(depending on tag type)
oSupport for ISO 14443 Part 4 Type A and B cards, Mifare, FeliCa, and all four types of
NFC (ISO/IEC 18092 tags)
oBuilt-in anti-collision feature (only one tag is accessed at any time)
•Application Programming Interface:
oSupports PC/SC
oSupports CT-API (through wrapper on top of PC/SC)
•Built-in Peripheral:
oUser controllable bi-color LED
•Supports Android™ OS 3.1 and above
•Compliant with the following standards:
oISO 14443
oCE
oFCC
oVCCI
oPC/SC
oCCID
oMicrosoft WHQL
oRoHS

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 5 of 45
1.2. USB Interface
The ACR122T is connected to a computer through USB as specified in the USB Specification 1.1.
The ACR122T is working in Full speed mode, i.e. 12 Mbps.
Pin Signal Function
1 VBUS +5V power supply for the reader (Max 200 mA, Normal 100 mA)
2 D- Differential signal transmits data between ACR122T and PC.
3 D+ Differential signal transmits data between ACR122T and PC.
4 GND Reference voltage level for power supply
Table 1: USB Interface

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 6 of 45
2.0.Implementation
2.1. Communication Flow Chart of ACR122T
The ACR122T uses the same communication flow as the ACR122U NFC Reader, which is discussed
in this section. The Standard Microsoft CCID and PCSC drivers are used. Therefore, no ACS drivers
are required because the drivers are already built inside the Windows operating system. You also
have to modify your computer’s registry settings to be able to use the full capabilities of the ACR122T
NFC Reader. See Appendix A for more details.
Figure 1: Communication Flow Chart of ACR122T

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 7 of 45
2.2. Smart Card Reader Interface Overview
Just click the “Device Manager” to find out the “ACR122T PICC Interface”. The standard Microsoft
USB CCID Driver is used.
Figure 2: Smart Card Reader Interface on the Device Manager

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 8 of 45
3.0.PICC Interface Description
3.1. ATR Generation
If the reader detects a PICC, an ATR will be sent to the PCSC driver for identifying the PICC.
3.1.1. ATR Format for ISO 14443 Part 3 PICCs
Byte Value
(Hex) Designation Description
0 3Bh Initial Header -
1 8Nh T0
Higher nibble 8 means: no TA1, TB1, TC1
only TD1 is following.
Lower nibble N is the number of historical
bytes (HistByte 0 to HistByte N-1)
2 80h TD1
Higher nibble 8 means: no TA2, TB2, TC2
only TD2 is following.
Lower nibble 0 means T = 0
3 01h TD2
Higher nibble 0 means no TA3, TB3, TC3,
TD3 following.
Lower nibble 1 means T = 1
4
To
3+N
80h T1
Category indicator byte, 80 means A status
indicator may be present in an optional
COMPACT-TLV data object
4Fh
Tk
Application identifier Presence Indicator
0Ch Length
RID Registered Application Provider Identifier
(RID) # A0 00 00 03 06h
SS Byte for standard
C0 .. C1h Bytes for card name
00 00 00 00h RFU RFU # 00 00 00 00h
4+N UUh TCK Exclusive-oring of all the bytes T0 to Tk
Table 2: ATR Format for ISO 14443 Part 3 PICCs
Example:
ATR for Mifare 1K = {3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6Ah}
ATR
Initial
Header T0 TD1 TD2 T1 Tk Length RID Standard Card
Name RFU TCK
3Bh 8Fh 80h 01h 80h 4Fh 0Ch
A0 00
00 03
06h
03h 00 01h 00 00
00 00h 6Ah
Where:
Length (YY) = 0Ch

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 9 of 45
RID = A0 00 00 03 06h (PC/SC Workgroup)
Standard (SS) = 03h (ISO 14443A, Part 3)
Card Name (C0 .. C1) = [00 01h] (Mifare 1K)
Where, Card Name (C0 .. C1)
00 01h: Mifare 1K
00 02h: Mifare 4K
00 03h: Mifare Ultralight
00 26h: Mifare Mini
F0 04h: Topaz and Jewel
F0 11h: FeliCa 212K
F0 12h: Felica 424K
FFh [SAK]: Undefined
3.1.2. ATR Format for ISO 14443 Part 4 PICCs
Byte Value (Hex) Designation Description
0 3Bh Initial Header -
1 8Nh T0
Higher nibble 8 means: no TA1, TB1, TC1
only TD1 is following.
Lower nibble N is the number of historical
bytes (HistByte 0 to HistByte N-1)
2 80h TD1
Higher nibble 8 means: no TA2, TB2, TC2
only TD2 is following.
Lower nibble 0 means T = 0
3 01h TD2
Higher nibble 0 means no TA3, TB3, TC3,
TD3 following.
Lower nibble 1 means T = 1
4
to
3 + N
XXh T1 Historical Bytes:
ISO 14443A:
The historical bytes from ATS response. Refer
to the ISO14443-4 specification.
ISO 14443B:
The higher layer response from the ATTRIB
response (ATQB). Refer to the ISO14443-3
specification.
XXh
XX
XXh
Tk
4+N UUh TCK Exclusive-oring of all the bytes T0 to Tk
Table 3: ATR Format for ISO 14443 Part 4 PICCs
We take for example, an ATR for DESFire, which is:
DESFire (ATR) = 3B 86 80 01 06 75 77 81 02 80 00h

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 10 of 45
ATR
Initial Header T0 TD1 TD2 ATS
T1 Tk TCK
3Bh 86h 80h 01h 06h 75 77 81 02 80h 00h
This ATR has 6 bytes of ATS, which is: [06 75 77 81 02 80h]
Note: Use the APDU “FF CA 01 00 00h” to distinguish the ISO 14443A-4 and ISO 14443B-4 PICCs,
and retrieve the full ATS if available. The ATS is returned for ISO 14443A-3 or ISO 14443B-3/4
PICCs.
Another example would be the ATR for ST19XRC8E, which is:
ST19XRC8E (ATR) = 3B 8C 80 01 50 12 23 45 56 12 53 54 4E 33 81 C3 55h
ATR
Initial Header T0 TD1 TD2 ATQB
T1 Tk TCK
3Bh 86h 80h 01h 50h 12 23 45 56 12 53 54 4E 33 81 C3h 55h
Since this card follows ISO 14443 Type B, the response would be ATQB which is 50 12 23 45 56 12
53 54 4E 33 81 C3h is 12 bytes long with no CRC-B.
Note: You can refer to the ISO7816, ISO14443 and PC/SC standards for more details.

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 11 of 45
4.0.PICC Commands for General Purposes
4.1. Get Data
The “Get Data command” will return the serial number or ATS of the “Connected PICC.”
Get UID APDU Format (5 Bytes)
Command Class INS P1 P2 Le
Get Data FFh CAh 00h
01h 00h 00h
(Full Length)
Get UID Response Format (UID + 2 Bytes) if P1 = 0x00h
Response Data Out
Result UID
(LSB) - - UID
(MSB) SW1 SW2
Get ATS of a ISO 14443 A card (ATS + 2 Bytes) if P1 = 0x01h
Response Data Out
Result ATS SW1 SW2
Response Codes
Results SW1 SW2 Meaning
Success 90 00h The operation completed successfully.
Error 63 00h The operation failed.
Error 6A 81h Function not supported.
Example:
1. To get the serial number of the “connected PICC”
UINT8 GET_UID[5]={0xFFh, 0xCAh, 0x00h, 0x00h, 0x04h};
2. To get the ATS of the “connected ISO 14443 A PICC”
UINT8 GET_ATS[5]={0xFFh, 0xCAh, 0x01h, 0x00h, 0x04h};

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 12 of 45
5.0.PICC Commands (T=CL Emulation) for Mifare Classic
Memory Cards
5.1. Load Authentication Keys
The “Load Authentication Keys command” will load the authentication keys into the reader. The
authentication keys are used to authenticate the particular sector of the Mifare 1K/4K Memory Card.
Volatile authentication key location is provided.
Load Authentication Keys APDU Format (11 Bytes)
Command Class INS P1 P2 Lc Data In
Load Authentication Keys FFh 82h Key Structure Key Number 06h Key
(6 Bytes)
Where
Key Structure: 1 Byte.
0x00h = Key is loaded into the reader volatile memory.
Other = Reserved.
Key Number: 1 Byte.
0x00h ~ 0x01h = Key Location. The keys will disappear once the reader is
disconnected from the PC.
Key: 6 Bytes.
The key value loaded into the reader. E.g. {FF FF FF FF FF FFh}
Load Authentication Keys Response Format (2 Bytes)
Response Data Out
Result SW1 SW2
Response Codes
Results SW1 SW2 Meaning
Success 90 00h The operation is completed successfully.
Error 63 00h The operation is failed.
Example:
Load a key {FF FF FF FF FF FFh} into the key location 0x00h.
APDU = {FF 82 00 00 06 FF FF FF FF FF FFh}

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 13 of 45
5.2. Authentication
The “Authentication command” uses the keys stored in the reader to do authentication with the Mifare
1K/4K card (PICC). Two types of authentication keys are used: TYPE_A and TYPE_B.
Load Authentication Keys APDU Format (6 Bytes) [Obsolete]
Command Class INS P1 P2 P3 Data In
Authentication FFh 88h 00h Block Number Key Type Key Number
Load Authentication Keys APDU Format (10 Bytes)
Command Class INS P1 P2 Lc Data In
Authentication FFh 86h 00h 00h 05h Authenticate Data Bytes
Authenticate Data Bytes (5 Bytes)
Byte 1 Byte 2 Byte 3 Byte 4 Byte 5
Version
0x01h 0x00h Block Number Key Type Key Number
Where:
Block Number: 1 Byte. This is the memory block to be authenticated.
Key Type: 1 Byte
0x60h = Key is used as a TYPE A key for authentication.
0x61h = Key is used as a TYPE B key for authentication.
Key Number: 1 Byte
0x00h ~ 0x01h = Key Location.
Note: For Mifare 1K Card, it has totally 16 sectors and each sector consists of 4 consecutive blocks.
E.g. Sector 0x00h consists of Blocks {0x00h, 0x01h, 0x02h and 0x03h}; Sector 0x01h consists of
Blocks {0x04h, 0x05h, 0x06h and 0x07h}; the last sector 0x0Fh consists of Blocks {0x3Ch, 0x3Dh,
0x3Eh and 0x3Fh}.
Once the authentication is done successfully, there is no need to do the authentication again provided
that the blocks to be accessed are belonging to the same sector. Please refer to the Mifare 1K/4K
specification for more details.
Load Authentication Keys Response Format (2 Bytes)
Response Data Out
Result SW1 SW2
Load Authentication Keys Response Codes
Results SW1 SW2 Meaning
Success 90 00h The operation is completed successfully.
Error 63 00h The operation is failed.

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 14 of 45
Sectors
(Total 16 sectors. Each
sector consists of 4
consecutive blocks)
Data Blocks
(3 blocks, 16 bytes per
block)
Trailer Block
(1 block, 16 bytes)
Sector 0 0x00 ~ 0x02h 0x03h
Sector 1 0x04 ~ 0x06h 0x07h
..
..
Sector 14 0x38 ~ 0x0Ah 0x3Bh
Sector 15 0x3C ~ 0x3Eh 0x3Fh
Table 4: Mifare 1K Memory Map
Sectors
(Total 32 sectors. Each
sector consists of 4
consecutive blocks)
Data Blocks
(3 blocks, 16 bytes per
block)
Trailer Block
(1 block, 16 bytes)
Sector 0 0x00 ~ 0x02h 0x03h
Sector 1 0x04 ~ 0x06h 0x07h
..
..
Sector 30 0x78 ~ 0x7Ah 0x7Bh
Sector 31 0x7C ~ 0x7Eh 0x7Fh
Sectors
(Total 8 sectors. Each
sector consists of 16
consecutive blocks)
Data Blocks
(15 blocks, 16 bytes
per block)
Trailer Block
(1 block, 16 bytes)
Sector 32 0x80 ~ 0x8Eh 0x8Fh
Sector 33 0x90 ~ 0x9Eh 0x9Fh
..
..
Sector 38 0xE0 ~ 0xEEh 0xEFh
Sector 39 0xF0 ~ 0xFEh 0xFFh
Table 5: Mifare 4K Memory Map
1K
Bytes
2K
Bytes
2K
Bytes

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 15 of 45
Byte Number 0 1 2 3 Page
Serial Number SN0 SN1 SN2 BCC0 0
Serial Number SN3 SN4 SN5 SN6 1
Internal/Lock BCC1 Internal Lock0 Lock1 2
OTP OPT0 OPT1 OTP2 OTP3 3
Data read/write Data0 Data1 Data2 Data3 4
Data read/write Data4 Data5 Data6 Data7 5
Data read/write Data8 Data9 Data10 Data11 6
Data read/write Data12 Data13 Data14 Data15 7
Data read/write Data16 Data17 Data18 Data19 8
Data read/write Data20 Data21 Data22 Data23 9
Data read/write Data24 Data25 Data26 Data27 10
Data read/write Data28 Data29 Data30 Data31 11
Data read/write Data32 Data33 Data34 Data35 12
Data read/write Data36 Data37 Data38 Data39 13
Data read/write Data40 Data41 Data42 Data43 14
Data read/write Data44 Data45 Data46 Data47 15
Table 6: Mifare Ultralight Memory Map
Example:
1. To authenticate the Block 0x04hwith a {TYPE A, key number 0x00h}. For PC/SC V2.01,
Obsolete.
APDU = {FF 88 00 04 60 00h};
2. To authenticate the Block 0x04hwith a {TYPE A, key number 0x00h}. For PC/SC V2.07
alaAPDU = {FF 86 00 00 05 01 00 04 60 00h}
Note: Mifare Ultralight does not need to do any authentication. The memory is free to access.
512 bits
Or
64 Bytes

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 16 of 45
5.3. Read Binary Blocks
The “Read Binary Blocks command” is used for retrieving a “data blocks” from the PICC. The data
block/trailer block must be authenticated first.
Read Binary APDU Format (5 Bytes)
Command Class INS P1 P2 Le
Read Binary Blocks FFh B0h 00h Block Number Number of Bytes to Read
Where:
Block Number: 1 Byte. The block to be accessed
Number of Bytes to Read: 1 Byte. Maximum 16 bytes
Read Binary Block Response Format (N + 2 Bytes)
Response Data Out
Result 0 <= N <= 16 SW1 SW2
Response Codes
Results SW1 SW2 Meaning
Success 90 00h The operation completed successfully.
Error 63 00h The operation failed.
Example:
1. Read 16 bytes from the binary block 0x04h (Mifare 1K or 4K)
APDU = {FF B0 00 04 10h}
2. Read 4 bytes from the binary Page 0x04h (Mifare Ultralight)
APDU = {FF B0 00 04 04h}
3. Read 16 bytes starting from the binary Page 0x04h (Mifare Ultralight) (Pages 4, 5, 6 and 7
will be read)
APDU = {FF B0 00 04 10h}

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 17 of 45
5.4. Update Binary Blocks
The “Update Binary Blocks command” is used for writing a “data blocks” into the PICC. The data
block/trailer block must be authenticated.
Update Binary APDU Format (4 or 16 + 5 Bytes)
Command Class INS P1 P2 Lc Data In
Update Binary
Blocks FFh D6h 00h Block
Number
Number
of Bytes
to
Update
Block Data
4 Bytes for Mifare
Ultralight or
16 Bytes for Mifare
1K/4K
Where:
Block Number: 1 Byte. The starting block to be updated.
Number of Bytes to Update: 1 Byte.
16 bytes for Mifare 1K/4K
4 bytes for Mifare Ultralight.
Block Data: 4 or 16 Bytes. The data to be written into the binary block/blocks.
Update Binary Block Response Codes (2 Bytes)
Results SW1 SW2 Meaning
Success 90 00h The operation completed successfully.
Error 63 00h The operation failed.
Example:
1. Update the binary block 0x04hof Mifare 1K/4K with Data {00 01 .. 0Fh}
APDU = {FF D6 00 04 10 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0Fh}
2. Update the binary block 0x04hof Mifare Ultralight with Data {00 01 02 03}
APDU = {FF D6 00 04 04 00 01 02 03h}

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 18 of 45
5.5. Value Block Related Commands
The data block can be used as value block for implementing value-based applications.
5.5.1. Value Block Operation
The “Value Block Operation command” is used for manipulating value-based transactions. E.g.
Increment a value of the value block etc.
Value Block Operation APDU Format (10 Bytes)
Command Class INS P1 P2 Lc Data In
Value Block
Operation FFh D7h 00h Block
Number 05h VB_OP
VB_Value
(4 Bytes)
{MSB .. LSB}
Where:
Block Number: 1 Byte. The value block to be manipulated.
VB_OP: 1 Byte.
0x00h = Store the VB_Value into the block. The block will then be converted to a value block.
0x01h = Increment the value of the value block by the VB_Value. This command is only valid
for value block.
0x02h = Decrement the value of the value block by the VB_Value. This command is only valid
for value block.
VB_Value: 4 Bytes. The value used for value manipulation. The value is a signed long
integer (4 bytes).
Example 1: Decimal –4 = {0xFFh, 0xFFh, 0xFFh, 0xFCh}
VB_Value
MSB LSB
FFh FFh FFh FCh
Example 2: Decimal 1 = {0x00h, 0x00h, 0x00h, 0x01h}
VB_Value
MSB LSB
00h 00h 00h 01h
Value Block Operation Response Format (2 Bytes)
Response Data Out
Result SW1 SW2
Response Codes
Results SW1 SW2 Meaning
Success 90 00h The operation completed successfully.

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 19 of 45
Results SW1 SW2 Meaning
Error 63 00h The operation failed.
5.5.2. Read Value Block
The “Read Value Block command” is used for retrieving the value from the value block. This
command is only valid for value block.
Read Value Block APDU Format (5 Bytes)
Command Class INS P1 P2 Le
Read Value Block FFh B1h 00h Block Number 04h
Where:
Block Number: 1 Byte. The value block to be accessed.
Read Value Block Response Format (4 + 2 Bytes)
Response Data Out
Result Value
{MSB .. LSB} SW1 SW2
Where:
Value: 4 Bytes. The value returned from the card. The value is a signed long integer (4
bytes).
Example 1: Decimal –4 = {0xFFh, 0xFFh, 0xFFh, 0xFCh}
Value
MSB LSB
FFh FFh FFh FCh
Example 2: Decimal 1 = {0x00h, 0x00h, 0x00h, 0x01h}
Value
MSB LSB
00h 00h 00h 01h
Response Codes
Results SW1 SW2 Meaning
Success 90 00h The operation completed successfully.
Error 63 00h The operation failed.
5.5.3. Restore Value Block
The “Restore Value Block command” is used to copy a value from a value block to another value

ACR122T – Application Programming Interface info@acs.com.hk
Version 2.02 www.acs.com.hk
Page 20 of 45
block.
Restore Value Block APDU Format (7 Bytes)
Command Class INS P1 P2 Lc Data In
Value Block
Operation FFh D7h 00h Source Block Number 02h 03h Target Block
Number
Where:
Source Block Number: 1 Byte. The value of the source value block will be copied to the
target value block.
Target Block Number: 1 Byte. The value block to be restored. The source and target value
blocks must be in the same sector.
Restore Value Block Response Format (2 Bytes)
Response Data Out
Result SW1 SW2
Response Codes
Results SW1 SW2 Meaning
Success 90 00h The operation completed successfully.
Error 63 00h The operation failed.
Example:
1. Store a value “1” into block 0x05h
APDU = {FF D7 00 05 05 00 00 00 00 01h}
Answer: 90 00h
2. Read the value block 0x05h
APDU = {FF B1 00 05 00h}
Answer: 00 00 00 01 90 00h [9000h]
3. Copy the value from value block 0x05h to value block 0x06h
APDU = {FF D7 00 05 02 03 06h}
Answer: 90 00h [9000h]
4. Increment the value block 0x05h by “5”
APDU = {FF D7 00 05 05 01 00 00 00 05h}
Answer: 90 00h [9000h]
Table of contents