在此之前,要先了解一下动物识别标准。

1 国际动物识别标准介绍

ISO 11784:动物的射频识别——代码结构。

ISO 11785:动物的射频识别——技术标准。

ISO 11784和11785分别规定了动物识别的代码结构和技术准则。标准中没有对应答器样式尺寸加以规定,因此可以设计成适合于所涉及动物的各种形式,如玻璃管状、耳标或项圈等。
1.1 代码结构——国际标准ISO 11784

代码结构为64位,如表1所列。其中的27~64位可由各个国家自行定义。

表1 RFID 11784和11785标准代码结构

各国国内识别代码由该国自行管理。27~64位也可以分配用于区别不同的动物类型、品种、所在区域、饲养者等等。这些在此标签内没有做出规定。

技术准则规定了应答器的数据传输方法和阅读器规范。工作频率为134.2 kHz,数据传输方式有全双工和半双工两种,阅读器数据以差分双相代码表示。应答器采用FSK调制,NRZ编码。

由于较长的应答器充电时间和工作频率的限制,通信速率较低。

1.2 技术标准——国际标准ISO 11785

ISO 11785技术标准规定了电子标签的数据传输方法和读写器规范,以便激活电子标签的数据载体。制定该技术标准的目的是使范围广泛的不同制造商的电子标签能够使用一个共同的读写器来询问。动物识别用的符合国际标准的读写器能够识别和区分使用全双工/半双工的系统(负载调制)的电了标签和使用时序系统的电子标签。

1.2.1 全双工/半双工系统

全双工/半双工电子标签通过活化场得到电源,并立即开始传输存储的数据。因为是不需要副载波的负载调制过程,同时数据表示成差分双相代码(DBP),把读写器频率除以32即可以得到位率。当频率为134.2 kHz时,传输速率(位率)为4 194 bps。

全双工/半双工数据报文包括了11位的起始域(头标)、64位(8字节)有用数据、16位(2字节)CRC以及24位(3字节)终止域(尾标)。每传输8位后,插入一个逻辑“1”电平的填充位,以便避免出现头标为“00000000001”的情况。在给定传输速率的情况下,传输128位大约需要30.5 ms。

1.2.2 时序系统

每50 ms后活化场暂停3 ms。时序电子标签事先已经通过活化场充入了能量,在活化场暂停后大约1~2 ms开始传输存储的数据。

电子标签用频移键控(2FSK)调制法。位编码采用NRZ逻辑“0”与基频134.2 kHz对应,逻辑“1”与频率124.2 kHz对应。

把发送频率除以16就可以得到比特率。因此,在频移键控情况下,比特率对于逻辑“0”为8 387 bps,对于逻辑“1”为7 762 bps。

时序数据报文包括了8位起始域01111110b、64位(8字节)有用数据、16位(2字节)CRC以及24位(3字节)终止域,没有填充位。

在给定传输速率的情况下,传输112位最多需要14.5 ms(“1”序列)。

2 动物识别卡片结构说明

根据动物识别的标准,可以得到动物识别卡片数据发送的顺序,即从第1个字节的bit0发送到第16个字节的bit7。

动物识别卡片数据发送表见本刊网站(编者注)。表中内容说明如下:

(1) DATA1~DATA64

① National ID: 高位到低位=DATA27~DATA64=NID37~NID0
举例:假设要写入的是11223344556(十进制)(最大为274877906944),
对应于十六进制是1A21A278BE,
对应于二进制是01 1010 0010 0001 1010 0010 0111 1000 1011 1110,
对应于表中的NID就是从NID37~NID0。

② Country ID: 高位到低位=DATA17~DATA26=CID9~CID0
举例: 假设要写入的是1000(十进制)(最大为1024),
对应于十六进制是3E8,
对应于二进制是11 1110 1000,
对应于表中的CID就是从CID9~CID0。

③ DATA BLOCK: DATA16。
④ Reserved: DATA2~DATA15。
⑤ Animal FLAG: DATA1。

(2) CRC部分为8字节的校验

buf[0]~buf[7]为8字节有效数据。crc_value为CRC16_ccitt校验数据。

3 用EM4205制作动物识别卡

第1步:设计EM4205配置字。
对于符合ISO11784/5的FDXB 模式,
EM4205应该配置为:
◆ Biphase
◆ RF/32
◆ 返回4 BLOCK 16字节 (128位)ISO11784/5的有效数据,则BLOCK4为00020C8F。

第2步: 计算8字节64位的有效数据。
参考动物识别卡片数据发送表以及说明。
◆ 将十进制的National ID转化为38位的二进制数,最低位对应于标签结构中的第64位。
◆ 将十进制的Country ID转化为10位的二进制数,加入到38位National ID之前。
◆ 加入1位DATA BLOCK。
◆ 加入14位Reserved位 0。
◆ 加入1位Animal FLAG。
上述5项组成64位二进制数据。

第3步:计算2字节CRC。
根据上文的CRC计算例程,计算64位(8字节)数据的2字节CRC校验字节。

第4步:组成16字节的动物标签最终数据。
以发送的顺序组成16字节(128位)的数据。
◆ 加入000000001。
◆ 加入8字节有效,然后再加入2字节CRC校验数据,每个字节后面跟1个1。
◆ 加入3字节空数据,每个字节后面跟1个1。

第5步:16字节数据写入卡片。
由于每个BLOCK(32位)的发送顺序为位0—位31,将16个字节放入4个BLOCK中的时候要作如下处理:
第1个BLOCK:BYTE4+BYTE3+BYTE2+BYTE1。
第2个BLOCK:BYTE8+BYTE7+BYTE6+BYTE5。
第3个BLOCK:BYTE12+BYTE11+BYTE10+BYTE9。
第4个BLOCK:BYTE16+BYTE15+BYTE14+BYTE13。
至此,由EM4205卡编写而成的ISO11784/5动物识别卡制作完成。

FDX-B frequency and modulation.
FDX-B protocol based transponders are defined to operate in the 134.2kHz band, and employ a biphase
encoding scheme to transmit their information. The data bit rate used is always fc/32.

Biphase encoding schemes modulate the RF field so that there is a transition at the beginning of each bit
boundary. A logic 0 state has a transition in the middle of the bit period, while a logic 1 state has no transition
during the entire bit period. For FDX-B 1 bit length corresponds to 32 cycles of the activated field of the reader.

FDX-B data structure.
FDX-B protocol based transponders carry 128 bits of data. The structure of this data consists of:
11 header bits (10000000000) Lsb bit first.
64 identification bits with 8 control bits.
16 bits of CRC with 2 control bits.
24 bits of extended data with 3 control bits.
The control bits are simple logic 1 bits that appear after every 8 bits. They are used to differentiate the
11 bit header from the remaining data. Below is shown an example of the FDX-B data structure.

msb lsb
1 0 0 0 0 0 0 0 0 0 0 Header pattern. 11 bits.
1 1 1 1 1 0 0 0 0
1 0 0 0 0 0 0 1 1 38 bit (12 digit) National code.
1 0 0 0 0 0 0 0 0 eg. 000000001008 (decimal).
1 0 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0 10 bit (3 digit) Country code.
1 1 1 1 1 1 0 0 1 eg. 999 (decimal).
1 – – – – – – – 1 1 bit data block status flag.
1 1 – – – – – – – 1 bit animal application indicator.
1 1 1 0 1 0 1 1 0 16 bit checksum.
1 0 1 0 1 1 1 0 1
1 0 1 0 1 0 1 1 0 24 bits of extra data if present.
1 0 0 1 1 0 1 0 0 eg. $123456.
1 0 0 0 1 0 0 1 0

When the Tag enters the electromagnetic field transmitted by the RFID reader it draws power from the field
and will commence transmitting its data as shown above with the least significant bit (lsb) first. The 11 bit
header pattern is transmitted to indicate the beginning of the data block.

This is followed by 38 bits of the identification code. For an animal application this will be the identity code of
the animal. This is a unique 12 digit decimal code for each animal.
After every 8 bits is sent a logic 1 bit is inserted to differentiate data from the header sequence.

This is followed by the 10 bit country code. A country code is a 3 decimal digit value used to refer to
individual manufacturers. A code of 999 is used to indicate that the transponder is a test transponder and
need not contain a unique identification number.

The 1 bit data block status is an indicator flag to indicate whether an additional data block exists. A value of 1
indicates that the transponder contains an additional 24 bit data block. Otherwise it is 0. Following this we
have 14 reserved bits allocated for future use.

The animal application indicator is a single bit indicating that the transponder is used for animal identification.
This value is set to 1 to indicate an animal identification application, and 0 otherwise.

The preceding 64 bit block (excluding control bits) is then used to calculate a 16 bit checksum. The calculation
for this CRC checksum is defined in ISO 11784 & 11785 and is included after the animal status bit.

After the CRC check bits we have the extra data block. This data block exists if the data block status flag is 1.
When the data block status flag is 0 this value will be 000000. The data block may be used to append
additional data relevant to the individual application.

Priority 1 Design carries a stock of low cost rfid reader writer units that are capable of reading and writing
FDX-B and HDX protocol transponders.

————————————————
版权声明:本文为CSDN博主「偏执灬」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sinat_23338865/article/details/78587730

Source: (47条消息) 基于动物标签识别的基础知识以及FDX-B协议与结构介绍。_偏执灬的博客-CSDN博客