RS232 (MODBUS RTU) Communication Protocol Industrial Automation RFID Card Reader | Reader CK-FR03-B01 Development Manual

RS232 (MODBUS RTU) communication protocol industrial automation RFID card reader|reader CK-FR03-B01 is a high-frequency card reader based on RS232, MODBUS RTU communication protocol and ISO15693 protocol recommended by Huaxiang Tiancheng Technology , It can support multiple card readers to work online, and is widely used in various industrial automation and automated manufacturing fields, such as automatic production management of cutting tools, automatic production management of auto parts assembly lines. The product provides complete development manuals, code cases and test tools, convenient integration, simple operation, good stability, and supports the joint debugging and communication of PLC equipment, which is deeply loved by system integrators.

1. LED indicator

 

                                                                                                                  LED indicator: label detection indicator

The working process of the card reader:

After the card reader is connected to the power supply, the card reader enters the auto-tuning state and performs self-test. After the self-test is successful, the green LED flashes, and then enters the working state, and the indicator light goes out. When the reader detects the presence of the RFID tag, the green LED will be on.

2. Wiring instructions

The CK-FR03-B01 wiring terminal is defined as follows:

 

                                                                                                                                      CK-FR03-B01 terminal definition

CK-FR03-B01:

Terminal number

interface

Description

1

VCC

Card reader power supply 24V

2

TXD

RS232 communication port TXD end

3

GND

Reader 0V

4

RXD

RS232 communication port RXD end

3. CK-FR03-B01 stand - alone wiring diagram


When CK-FR03-B01 is working in stand-alone mode, the wiring is as follows:

 

                                                                                                                                      CK-FR03-B01 stand-alone communication

4. Register address allocation of card reader

Some registers of the card reader are used to set the device address, communication baud rate, communication verification method and the working mode of the reader, and some registers are used to display the detection status of the RFID card and display whether the command is executed normally

After setting the registers that can be set by the card reader, the set value will be saved after power-off, and the card reader will work with the current set value after power-on again.

4.1. Device address register add=0x0000

Register 0x0000 is used to save the slave ID of the device. When the device address is to be changed, write the corresponding ID number to the register. For example, if the device address is 0x01, write 0x01.

  1. ID=0 is the broadcast address, any device can receive ID.
  2. If the data of this register is 0xffff, it is the default factory device address 0x02.
  3. Use MODUBUS function code: 03 06 16, other function codes return error codes.
  4. Factory default value: Slave ID =0x0002.

4.2. Baud rate setting register add=0x0001

Write different values ​​to this register to change different baud rates. The relationship between baud rate and value is:

 Correspondence table of baud rate and register setting value

Baud rate

Register value (H)

4800

0001

9600

0002

19200

0003

38400

0004

115200

0005

115200

FFFF

invalid

Other value

  1. If the data in this register is 0xffff, it is the default factory baud rate of 115200.
  2. Use MODUBUS function code: 03 06 16, other function codes return error codes.
  3. Factory default value: baud rate=115200pbs.

4.3, parity bit setting register add=0x0002

Write different values ​​to this register to set the verification mode. The relationship between the verification mode and the value is:

Parity check and register setting value correspondence table

Verification method

Register value (H)

No verification

0001

Even parity

0002

Odd parity

0003

No verification

FFFF

invalid

Other value

  1. Use MODUBUS function code: 03 06 16, other function codes return error codes.
  2. Factory default value: no check digit.

4.4. Card reading mode register add=0x0003

Write different values ​​to this register to set different modes. The relationship between mode and value is:

Correspondence table of card reader working mode and setting value

Card reader mode

Register value (H)

Standard MODBUS

0001

Continue Read  Mode

0003

Read Once Mode

0004

Standard MODBUS

FFFF

invalid

Other value

Mode function definition:

  1. Standard MODBUS : Standard MODBUS RTU communication mode, one answer and one answer
  2. Continue Read Mode : After setting to this mode, as long as the slave device receives a MODBUS query command, the slave device will continue to execute the command, and the slave device will send the successfully read data until it sends a command to change this mode.
  3. Read Once Mode : After setting to this mode, as long as the slave device receives a MODBUS query command, the slave device will always execute the command, and the slave device will send the successfully read data until it sends a command to change this mode. But the same RFID card can only be read once in a row, that is, read card A, send the read data, then read card A, no more data, until card B is read, then card A can be read .
  • Use MODUBUS function code: 03 06 16, other function codes return error codes.
  • Factory default mode: standard MODBUS

4.5. RFID tag status flag register add=0x0004

RFID tag status register

RFID status

Register value (H)

There is a label in the card reading range

0001

There is no label in the card reading range

0000

The tag status flag register is used to quickly query whether there is a readable RFID tag within the sensing range of the card reader.

  1. If the register value is 0x0001, there is a tag in the sensor area of ​​the card reader;
  2. If the register value is 0x0000, there is no tag in the sensing range of the card reader.

Note: When there is no tag in the sensing range, if the tag is read and written, the card reader will not be able to complete the operation normally. If there is no label, the register value returned after the read operation is 0.

4.6, read and write status register add=0x0005

Read and write status register

Read and write status

Register value (H)

Read and write operations are correct

0000

Read operation error

0001

Write error

0002

        读写状态寄存器用于显示读写操作后的状态变化,该寄存器只读。如果进行读操作,读操作过程出错则该寄存器值为0x0001,如果进行写操作,写操作过程出错则寄存器值为0x0002。如果读写操作过程均无误,则寄存器值为0x0000。

其中,单独发送读写操作查询命令(02 03 00 05 00 01 94 38),即只查询该寄存器时,读卡器返回的寄存器状态为上一次读写操作的状态,而不显示该查询命令的读写状态。

 读写状态查询命令

操作

状态

寄存器数值(HEX格式)

发送

查询命令

02 03 00 05 00 01 94 38

接收

读错误

02 03 02 00 01 3D 84

写错误

02 03 02 00 02 7D 85

读写无误

02 03 02 00 00 FC 44

当读操作错误时,返回的寄存器数值均为0,如发送指令02 03 00 06 00 04 A4 3B查询卡ID时,如果无卡则为02 03 08 00 00 00 00 00 00 00 00 9A 93。

其中当读操作中包含读写状态寄存器时,返回的数值中,读写状态寄存器状态为上一次读写操作(非读写操作查询命令操作)的状态。

相关的读操作查询读写状态寄存器流程如下:

 

                                                                                                                                       读操作查询读写状态寄存器流程

        在进行相关的读操作时,接收回来的数据在若为0,则存在读操作产生错误,或者所读取的数据本身为0两种情况。通过发送查询读写状态寄存器状态指令,根据读取状态寄存器的值判断上一次读操作是否正确,读写状态寄存器值为0x00则表明读操作无误,值为0x01则表明读操作出现错误。

相关的写操作查询读写状态寄存器流程如下:

 

                                                                                                                      写操作查询读写状态寄存器流程

        用户进行写数据操作时,接收读卡器应答后,可发送读写状态寄存器指令来获取上一次写操作是否正确执行,读写状态寄存器值为0x00则表明写操作无误,值为0x02则表明写操作出现错误。

5、RFID标签地址分配

RFID标签数据地址分配如下表:

RFID标签数据地址分配表

UID地址

addr=0x0006

addr=0x 0007

只读

addr=0x 0008

addr=0x 0009




 

addr=0x 000A

addr=0x 000B

读写

addr=0x 000C

addr=0x 000D

...

...

...

...

addr=0x 4103

addr=0x 4104

addr=0x 4105

addr=0x 4106

注:

  1. 最大可支持8K Byte容量标签的读写操作。标签根据不同型号有不同的容量值,具体可参考标签的数据手册。
  2. UID数据区RFID标签的出厂ID存放区,数据为只读,UID长度为8bytes,地址范围0x0006~0x0009。
  3. 地址addr=0x000A至addr=0x4106为用户数据寄存器,用户可对这些寄存器进行读写操作。

6、机械尺寸

CK-FR03-B01机械尺寸如下:

 

                                                                                                                                                     结构示意图

 

 

Guess you like

Origin blog.csdn.net/Alex88389516/article/details/109627841