ST_RFID_CfgStruct_BaltechMifVHLFile
The structure is suitable for writing with the eRFC_SetConfig command (see RFID command set).
This is not the parameterization of the TwinCAT RFID library but the proprietary configuration of the RFID reader.
TYPE ST_RFID_CfgStruct_BaltechMifVHLFile :
STRUCT
iVHLFile : USINT := 1; (* nr. of VHL file to configure *)
iNrOfKeys : USINT(1..8) := 1;
iNrOfSectors : USINT(1..56) := 16; (* default: 16 sectors -> 1024 bytes mifare card with 752 bytes user data *)
iRC500EEPOffset : USINT := 16#FF;
arrKeyList : ARRAY [0..7] OF T_RFID_MifareKey; (* up to 8 keys, 6 byte each *)
arrSectorList : ARRAY [0..55] OF BYTE (* up to 56 sectors accessible *)
:= 0,1,2,3,4,5,6,7,8,9,10, (* default: 16 sectors -> 1024 bytes mifare card with 752 bytes user data *)
11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30,
31,32,33,34,35,36,37,38,39,40,
41,42,43,44,45,46,47,48,49,50,
51,52,53,54,55;
arrRdKeyAssign : ARRAY [0..55] OF BYTE; (* Key index for each sector *)
arrWrKeyAssign : ARRAY [0..55] OF BYTE; (* Key index for each sector *)
bMAD_Mode : BOOL := FALSE; (* use MAD AID [default = FALSE] *)
iMAD_AID : USINT;
iReserved : INT;
END_STRUCT
END_TYPE
Structure of a Mifare card (up to 2 kB memory):
A Mifare card with 1 kB memory has 16 sectors with 64 bytes each. Each sector has 4 blocks. Sector 0 consists of blocks 0-3, sector 1 consists of block 4-7, and the following sectors are formed accordingly. In the diagram each column represents a sector, while a box represents a 16-byte block.
![ST_RFID_CfgStruct_BaltechMifVHLFile 1:](Images/png/375247755__Web.png)
Only the blocks shown in white contain memory areas that can be used by the user. The maximum size of the user data is therefore 752 bytes (47 x 16 byte) for a 1024-byte Mifare card.
Name | Description |
---|---|
iVHLFile | iVHLFile is used to specify the number of the VHL file to be configured. The configuration of the RFID device can contain several VHL files side by side. |
iNrOfKeys | iNrOfKeys is used to specify the required number of keys. 1 to 8 keys can be defined. |
iNrOfSectors | iNrOfSectors is used to specify the number of sectors to be used for user data. A 1 KB Mifare card has 16 sectors [default: 16]. Example: If only sectors 4-6 are to be used, iNrOfSectors = 3 is specified. |
iRC500EEPOffset | This parameter refers to the internal transfer of the keys within the hardware of the RFID device. The default setting [16#FF] offers enhanced security. It is recommended to leave this setting unchanged. |
arrKeyList | All keys are stored in the array arrKeyList. A key is of type T_RFID_MifareKey and consists of 6 bytes. Example: If two keys are to be used, they are stored in arrKeyList[0] and arrLeyList[1]. TYPE T_RFID_MifareKey : |
arrSectorList | In array arrSectorList all sectors are stored that are to be used for user data. Example: If only sectors 4-6 used, the following specification is used: arrSectorList[0]=4, arrSectorList[1]=5, arrSectorList[2]=6. The array is already initialized with consecutive numbering. In most cases no change is required. |
arrRdKeyAssign | In the array arrRdKeyAssign the key index for each used sector is stored. Example: For a 1 kB Mifare card all sectors should be used (iNrOfSectors = 16). Two keys are used (iNrOfKeys = 2) The first half of the sectors on this card should be read with the first key (arrKeyList[0]), the second half with the second key (arrKeyList[1]). In the array arrRdKeyAssign the indices stCfg : ST_RFID_CfgStruct_BaltechMifVHLFile := (arrRdKeyAssign:=0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1); should therefore be stored. If a single key is to be used for all sectors, the key index is 0 for all sectors. The array is already initialized with 0. In this case no change is required. |
arrWrKeyAssign | In the array arrWrKeyAssign the key index for each used sector is stored. Example: For a 1 kB Mifare card all sectors should be used (iNrOfSectors = 16). Two keys are used (iNrOfKeys = 2) The first half of the sectors on this card should be written with the first key (arrKeyList[0]), the second half with the second key (arrKeyList[1]). In the array arrWrKeyAssign the indices stCfg:ST_RFID_CfgStruct_BaltechMifVHLFile:=(arrWrKeyAssign:=0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1); should therefore be stored. If a single key is to be used for all sectors, the key index is 0 for all sectors. The array is already initialized with 0. In this case no change is required. |
bMAD_Mode | If MAD (Mifare Application Directory) with AIDs (Application Identifiers) is to be used instead of the sector allocation, bMAD_Mode must be set (TRUE). The sector allocation is used as standard [default = FALSE]. |
iMAD_AID | The input is only required if MAD (Mifare Application Directory) is used (bMAD_Mode = TRUE). At the configuration input iMAD_AID the MAD AID (Application Identifier) for the VHL file is specified. |
Further information on the RFID reader configuration process is summarized in section Configuration.
Detailed information on the VHL file and the configuration of Baltech RFID devices can also be found in the manufacturer's documentation Mifare.pdf and ConfigurationValues.pdf in the Baltech SDK.
Requirements
Development Environment |
Target Platform |
PLC Libraries to include |
---|---|---|
TC3.1.4013 |
PC or CX (x86, x64) |
Tc2_RFID |