ST_RFID_Control
The input structure stCtrl contains variables with which the behavior of the function block can be parameterized.
The two variables tPreSendDelay and tPostSendDelay offer the option to parameterize delay times.
TYPE ST_RFID_Control :
STRUCT
sSelTranspSRN :T_RFID_TranspSRN; (* serial number shown as hex coded string(ascii) *)
tPreSendDelay :TIME; (* condition: tTimeOut > tPreSendDelay + tPostSendDelay *)
tPostSendDelay :TIME; (* condition: tTimeOut > tPreSendDelay + tPostSendDelay *)
iSrcAddrSnd :UDINT; (* RS485 address *)
iDstAddrSnd :UDINT; (* RS485 address *)
bAddrAutoMode :BOOL := TRUE; (* if AutoMode is activated the communication addresses are handled automatically and set addresses are not used. *)
bLogging :BOOL;
iHeadNumber :USINT := 1; (* if multiple read heads are installed at the reader unit, one can be selected *)
iDCType :USINT := 1;
pRawDataCommand :POINTER TO BYTE; (* data input for low level communication *)
iRawDataCommandLen :UINT;
bBufferedCmd :BOOL;
iVHLFileID :USINT := 16#FF; (* selection of VHL file; default 0xFF (ad hoc VHL file of vhlSetup) *)
iCardTypeMask :UINT := 16#FFFF; (* select which card type should be detected via GetInventory; default 0xFFFF (all types) *)
bReselect :BOOL := TRUE; (* with Reselect every GetInventory gets the first item of the reader's detected card list *)
bAcceptConfCard :BOOL := TRUE; (* a read command also accept configuration cards to configure the RFID Reader *)
END_STRUCT
END_TYPE
![]() | Multiple RFID readers on the same RS485 network The TwinCAT RFID library does not support multiple RFID readers on the same RS485 network for the time being. A separate connection must be made to a separate terminal for each RFID reader. In this stand-alone mode, individual addressing with iSrcAddrSnd and iDstAddrSnd is not necessary. Addressing can therefore be handled automatically by the TwinCAT RFID library, for which the input variable bAddrAutoMode can be left as TRUE. |
All manufacturers
Name | Description |
---|---|
tPreSendDelay | Before sending a command to the RFID reader, the function block waits until the time specified by tPreSendDelay has elapsed. |
tPostSendDelay | After sending a command to the RFID reader, the function block waits until at least the time specified by tPostSendDelay has elapsed. If the expected response has not arrived yet, the function block continues to wait for the response until the specified timeout time tTimeOut has elapsed at the latest. |
iSrcAddrSnd | Source address in the case of RS485 communication. This address is used if bAddrAutoMode is not set. |
iDstAddrSnd | Destination address in the case of the RS485 communication. This address is used if bAddrAutoMode is not set. |
bAddrAutoMode | Option in the case of RS485 communication. If bAddrAutoMode is enabled [default: TRUE], the RS485 addresses are assigned automatically. The addresses given above are not used. If bAddrAutoMode is disabled (FALSE), the addresses specified above are used. |
bLogging | An additional output can be activated with bLogging. The serial communication can thus be reconstructed with the aid of Log View Messages. These messages can be viewed in the Windows Event Viewer as well as in the TwinCAT System Manager. This is useful for testing and analysis purposes. The format of the output is not specified, in order to facilitate extensions. The first time the function block is called with bLogging = TRUE, the output "Logging initialized" is generated. No communication data is monitored in this first cycle. |
pRawDataCommand | The regular function block of the TwinCAT RFID library can also be used for low-level communication. In this case, raw data can be sent directly to the RFID reader. The raw data to be sent (e.g. as a byte array) must be specified in this input variable. This is a pointer to the raw data to be sent. The library function block accesses this address in read-only mode. Further information on the process of low-level communication is summarized in section Low-level communication. Both the transmitted and the received raw data can be viewed at any time at the output by means of the structure ST_RFID_RawData. |
iRawDataCommandLen | The input variable iRawDataCommandLen specifies the length in bytes of the raw data specified by the pointer pRawDataCommand. |
Balluff
Name | Description |
---|---|
iHeadNumber | If an RFID reader with several read heads is addressed, the read head is specified in the input variable iHeadNumber. |
iDCType | If Balluff readers are used via iDCType, the block size of the chip memory (0→64bytes, 1→32bytes) can be specified. |
Baltech
Name | Description |
---|---|
iVHLFileID | Write and read commands are executed with the VHL file selected here. This must be stored in the configuration of the RFID device. If iVHLFileID has the value 0xFF [default], the RFID reader will not take a normal VHL file from its configuration, but a simple ad-hoc file, which can be selected so that non-configured/unencrypted blank cards can be used. |
iCardTypeMask | The iCardTypeMask can be used to set specific transponder card families. Only the set card types are recognized with the command GetInventory. All other card types are filtered out. If all card types are to be recognized, this value does not have to be changed [default: 0xFFFF]. For each accepted card family, the respective bit is set in the iCardTypeMask. |
bReselect | If bReselect is set [default: TRUE], a transponder is specified at the output for each query with the GetInventory command, provided a transponder is in the HF field. If it is ensured that there is only one card before the RFID reader at a time, this setting should be retained. If there is more than one transponder card in the HF field, the RFID device contains a list of detected cards. To be able to select all transponders with the command GetInventory, bReselect should be switched off [FALSE]. The command GetInventory then goes through this list through multiple sequential calls. After the last card has been selected, the feedback eRFR_NoTransponder follows. The GetInventory command does not return the transponder and its serial number to the output again until a card is removed from the HF field and inserted again. |
bAcceptConfCard | If bAcceptConfCard is set [default: TRUE], configuration cards are also recognized with the command GetInventory. An attempt is made automatically to transfer the configuration on these cards to the RFID reader. This parameter can be disabled to prevent influencing by other configuration cards. |
Leuze
Name | Description |
---|---|
sSelTranspSRN | The serial number of the transponder to which the command (e.g. read/write) is to be applied can be specified as a string on the input variable sSelTranspSRN. The data type is T_RFID_TranspSRN. |
Pepperl+Fuchs
Name | Description |
---|---|
iHeadNumber | If an RFID reader with several read heads is addressed, the read head is specified in the input variable iHeadNumber. iHeadNumber is also referred to as IdentChannel. |
iDCType | With this variable and the command ChangeDCType the transponder type can be set on the read head of Pepperl+Fuchs readers. Possible values for this are listed in the proprietary protocol under the ChangeTag command. (They do not match the values of the enumeration E_RFID_TranspType.) Extract of supported transponder types: |
bBufferedCmd | Most commands are processed once immediately after the call. Depending on the RFID reader, commands can be present continuously. This enables, among other things, a read process as soon as the RFID transponder enters the reading field, without sending an extra command. This can either be configured in the RFID reader configuration (Balluff, Deister, Leuze) or selected with this input variable (Pepperl+Fuchs). If such a buffered command is active on a read head, the trigger mode may neither be active nor activated for this channel! Similarly, no raw data command may be transmitted that concerns this channel! |
Delay times
The two variables tPreSendDelay and tPostSendDelay offer the option to parameterize delay times. Both variables ensure that a delay is awaited between two requests to the RFID reader.
If the delay time is specified as tPreSendDelay, a delay between the last response telegram and the next request telegram is ensured. If the request telegram is to be sent as directly as possible, tPostSendDelay can be used.
The condition tTimeOut > tPreSendDelay + tPostSendDelay applies. Otherwise an error is generated at the output.
A minimum delay time of 300 ms between two commands is specified in the proprietary protocol of the Balluff RFID reader.
A minimum delay time of 150 ms between reception and command is specified in the proprietary protocol of the Leuze electronic RFID reader.
![ST_RFID_Control 5:](Images/gif/180549643__en-US__Web.gif)
Requirements
Development Environment |
Target Platform |
PLC Libraries to include |
---|---|---|
TC3.1.4013 |
PC or CX (x86, x64) |
Tc2_RFID |