ACR1281U-C8 – Application Programming Interface
Version 1.00
www.acs.com.hk
Page 36 of 52
5.6. ACR120_WriteMasterKey
Writes master keys.
High Level API
:
DLLAPI INT16 AC_DECL
ACR120_WriteMasterKey(INT16 hReader,
UINT8 KeyNo,
UINT8 pKey[6]);
Parameters
Description
hReader
Handle to the reader returned by AC_Open()
KeyNo
Master key number
pKey
Key to write. It is AC_MIFARE_KEY_LEN(6) bytes
long.
Return Value
INT16
Result code. 0 means success.
Table 25
: ACR120_WriteMasterKey Command Description
Low Level Frame Structure:
Command: From PC to Reader (12 bytes)
Command Code
(1 byte)
Command Data length
(1 bytes)
Instruction Code
(1 byte)
Data length
(1 byte)
Data
(1 byte) (6 bytes)
E0h
09h
0Dh
07h
KeyNo
pKey
Response: From Reader to PC (11 bytes) <<Success >>
Response Code Response Status Response Data Length
Response Data
(1 byte)
(2 bytes)
(2 bytes)
(6 bytes)
E1h
INT16 (>=0)
0006h
KeyStored
Note:
The Response Data (KeyStored) is used for comparison only.
Or
Response: From Reader to PC (5 bytes) << Fail>>
Response Code
Response Status
Response Data Length
(1 byte)
(2 bytes)
(2 byes)
E1h
INT16 (<0)
0000h