Low level communication

In addition to the high level command set, the PLC RFID library also offers the possibility of low level communication. This is solved implicitly. The same function block is used.
Arbitrary telegrams can be received (up to a maximum size of 1024 bytes) and sent (up to a maximum size of 300 bytes).

A complete telegram is composed as follows:
| Prefix | Addressing | Raw data | CRC | Suffix |

Depending upon the proprietary protocol specification, individual components may be missing. In general, however, the composition is the same.

Sending

For this purpose the command eRFC_SendRawData from the command set is used and the raw data to be sent is specified in the input structure ST_RFID_Control.
To send a low level telegram only the raw data are specified. The other components of the telegram are supplemented automatically by the PLC RFID library. Checking data such as CRC are likewise generated and added internally.

Low level communication 1:

If the protocol demands the re-encoding of certain bytes within the raw data, this is similarly performed automatically by the PLC RFID library and does not have to be considered.

Low level communication 2:

If an RS485 interface is concerned, then the addressing must be specified separately. It may not be contained in the specified raw data. By default, the addressing is performed automatically by the library. However, it can be parameterized via the input variables in ST_RFID_Control.

The raw data last sent can be viewed at any time at the output of the function block by means of the structure ST_RFID_RawData. This is independent of the command used.

Receiving

The last raw data received can be viewed at any time at the output of the function block using the structure ST_RFID_RawData.
The associated addressing is output in the structure ST_RFID_ReaderInfo.

When using the SendRawData command, a direct evaluation of the received response cannot be guaranteed.

Example: if a read command is sent manually as a byte sequence by means of the SendRawData command, then received transponder data are not written at an address specified in ST_RFID_AccessData. The evaluation/storage of the data should therefore also take place manually with the aid of the raw data structure ST_RFID_RawData, which is always specified. The specified raw data is the received telegram, but without prefix, suffix, checksum, CRC or shift sequence coding.
If the received telegram was not evaluated regularly by the function block, this is also indicated by an error.

In order to be able to use the received data, these must be copied, for example, to a byte array.

Example of the assignment of received data with the aid of the MEMCPY () function:

fbRFIDReader    : FB_RFIDReader;
arrReceivedData : ARRAY [0..511] OF BYTE;
MEMSET( ADR(arrReceivedData), 0, SIZEOF(arrReceivedData) );
MEMCPY( ADR(arrReceivedData), fbRFIDReader.stRawData.pReceivedRsp, MIN(fbRFIDReader.stRawData.iReceivedRspLen, SIZEOF(arrReceivedData)) );
Low level communication 3:

Balluff RFID Reader: the end identifier (LF CR) is used as a suffix for the recognition of telegrams. Previous data are combined into a telegram as soon as these 2 bytes are detected in the data stream.