RFID anti-collision read-write equipment and control method thereof
Technical field
The present invention relates to the RFID(radio-frequency (RF) identification) device etc.Relate in particular to a kind of RFID anti-collision read-write equipment and control method thereof of the non-contact IC card of following ISO/IEC 14443 agreements of being controlled by digital machine.
Background technology
Along with the development of Communications And Computer technology, technology of Internet of things and people's life, work and amusement become more and more tightr.Radio frequency identification (RFID, Radio Frequency Identification) technology, as the gordian technique in Internet of Things sign link, also becomes the focus direction of all multi-experts and focus of attention in recent years.RFID is a kind of automatic identification technology that carries out contactless identification by radiofrequency signal, and its ultimate principle is the control coupling utilized between read-write equipment and electronic tag, comprise inductive coupling or electromagnetic coupled, or the transport property of reflection realizes data communication.
In rfid system, around label, may have a plurality of read-write equipments, like this, label may be received the order that different read-write equipments send simultaneously, now just produces the collision between read-write equipment simultaneously.But because read-write equipment has very strong processing power, and the probability of this collision is smaller, also easily solve, therefore generally not using it as the focus of attention.In addition, generally, all labels in same rfid system are operated in same channel, there are a plurality of labels in the reach of read-write equipment, and may there be a plurality of labels to communicate with read-write equipment at synchronization simultaneously, now will produce the phase mutual interference, namely collision or conflict have occurred in label, make read-write equipment can not correctly identify the information of any one label.
At present in the technical field of non-contact IC card and RFID, not only disclose the device that possesses contactless (wireless) interface, but also disclose the device (RFID device carrying equipment) that possesses contact (wired) interface be connected with main frame (also referred to as host CPU) with the RFID device.And these devices exist read-write equipment can't get rid of the inherent shortcoming of conflict impact.
Summary of the invention
Fundamental purpose of the present invention is to provide a kind of RFID anti-collision read-write equipment and control method thereof of non-contact IC card of the ISO/IEC of following 14443 agreements, can't get rid of the inherent shortcoming of conflict impact in order to overcome traditional read-write equipment.
The solution of the present invention is by such realization: a kind of RFID anti-collision read-write equipment, this device comprises an input equipment, two output devices, a read-write chip, a digital machine, input equipment, output device, read-write chip all are connected with digital machine, described input equipment is matrix keyboard, for the data that will write label, inputs to digital machine; Described two output devices are respectively LCD display device and UART communication facilities, the LCD display device is for showing flow process and the result of the operation of RFID anti-collision read-write equipment, and the UART communication facilities is for being transferred to read data transfer the order of this device to subordinate equipment or reception subordinate equipment; Described read-write chip is to follow the read-write chip MFRC522 of ISO/IEC 14443 agreements, the anti-collision algorithms of read-write chip based on the BIT collision detection protocol, and read-write chip just can be carried out the identification of next label after successfully identifying certain label; Described digital machine stores the label anti-confliction running program of read-write chip BIT collision detection protocol, ISO/IEC 14443 protocol definitions.
As the further improvement of RFID anti-collision read-write equipment of the present invention, described read-write chip is accepted the instruction and data of digital machine, and instruction and data is acted on corresponding label or obtains data from label and pass to digital machine; The needed parameter of described digital machine memory storage, and the information of processing input equipment and read-write chip MFRC522 submission.
Further improvement as RFID anti-collision read-write equipment of the present invention, the tag operational mode of described digital machine is finite state machine, after label receives a request command of read-write equipment, its state will be corresponding to certain state in finite state machine, if the success of label response command or failure, directly jump to corresponding state and enter next step processing.
As the further improvement of RFID anti-collision read-write equipment of the present invention, described digital machine comprises a microprocessor main control chip, microprocessor main control chip storage tags anti-collision running program, finite state machine mode of operation and other running programs.
As the further improvement of RFID anti-collision read-write equipment of the present invention, described other running programs comprise that matrix keyboard scanning sequence, UART DCP, LCD refresh display routine.
A kind of control method of RFID anti-collision read-write equipment, at first after opening read-write equipment, at first digital machine carries out initialization to read-write chip MFRC522, LCD display device, UART communicator, and then read-write equipment is sought tag operational, anti-collision operation, selection tag operational, read write tag operation, dormancy tag operational to the label execution entered in its antenna range successively.If the some operation stepss in whole flow process are carried out unsuccessfully, program is at once returned and is re-executed this operation, until this operation runs succeeded.
Further improvement as the control method of RFID anti-collision read-write equipment of the present invention, described read write tag operating process is: at first, program judgement select selected label after tag operational be carry out read tag operational or writing labels operation, if neither execution is read tag operational and is not also carried out the writing labels operation, just directly exit read-write state, wait for and receive the dormancy instruction.
Read tag operational if carry out, read-write equipment can send and read label instructions to selected label, label just returns to read-write equipment by the data of designated address space after receiving this instruction, read-write equipment is presented at it on LCD display device after getting the data that label returns, and by the UART communication facilities, the data of obtaining is sent to subordinate equipment.When label fail correctly to receive read-write equipment read label instructions the time, read-write equipment can repeat to send this and read label instructions, until label correctly receives this instruction return data, after reading tag operational and completing, label is waited for and is received the dormancy instruction.
If carry out the writing labels operation, program judges whether the data input buffer district is empty, if it is empty, on the LCD display device, export warning message, the prompting user input data, if judgement data input buffer district is that read-write equipment sends the writing labels instruction to selected label not for empty, and the data that will input data buffer write and are selected the corresponding address space of label.When label fails correctly to receive the writing labels instruction of read-write equipment, read-write equipment can repeat to send this writing labels instruction, until label correctly receives this instruction and the data in data input buffer district is written to the corresponding address space of label, after writing labels has operated, label is waited for and is received the dormancy instruction.
As the further improvement of the control method of RFID anti-collision read-write equipment of the present invention, described anti-collision is operating as based on BIT collision detection protocol and ISO/IEC 14443 agreements.Conceived with the computer control system of the anti-collision read-write equipment of the non-contact IC card of following ISO/IEC 14443 agreements, BIT collision detection protocol, reduced manually the intervention of label operations, improved the discrimination of label.
Further explanation as RFID anti-collision read-write equipment of the present invention and control method thereof, apparatus of the present invention and control method thereof are applied to the read-write identification of electronic tag (being consumption card, IC-card), and it is read and write identification range and is caning be controlled in electronic tag and read-write equipment distance in 10cm.
The know-why that the present invention realizes is: when label enters in the antenna reach of RFID anti-collision read-write equipment, label enters power-down state, label carries out changing idle condition into after reset operation at power-down state, label in idle condition is waited for the request-reply order of read-write equipment, if label response request acknowledgement command is successfully representing the anti-collision success, and having got the ID of certain label, label is in ready state.Utilize the label ID got previously, reading device continues to send select command, and selecteed label enters state of activation thereupon, and under this state, read-write equipment can be to operations such as label read-writes.After EO to label, reading device can send a dormancy instruction to label, and the label that receives this order enters dormant state immediately, until receive the wake command that read-write equipment sends.
The present invention possesses following good result:
(1) when the present invention ought only have a label to appear in the antenna reach of this read-write equipment, this device is the same with traditional read-write equipment, can be to this operation such as label execution read-write grade.In the time of in the antenna reach that simultaneously appears at this read-write equipment more than a label is arranged, this device can be judged the generation of conflict, then carry out anti-collision operation, finally complete successively to the operation such as the read-write of these cards rather than as traditional read-write equipment to the user report mistake or only to operations such as certain label execution read-writes wherein.
(2) the present invention is that the computer control system of following the anti-collision read-write equipment of the non-contact IC card of ISO/IEC 14443 agreements is conceived, thereby has reduced the artificial intervention to the label operations.Program has been used finite state machine to the operation of label, after label receives a request command of read-write equipment, its state will be corresponding to certain state in finite state machine, if the success of label response command or failure, can directly jump to corresponding state and enter next step processing, improve the efficiency of processing label.
(3) anti-collision algorithms of read-write chip of the present invention based on the BIT collision detection protocol, read-write equipment just can carry out the identification of next label after successfully identifying certain label, so discrimination >=99%.
The accompanying drawing explanation
Fig. 1. RFID anti-collision read-write equipment schematic diagram of the present invention.
Fig. 2. digital machine microprocessor main control chip structural representation in apparatus of the present invention.
Fig. 3. RFID anti-collision read-write equipment control method of the present invention constitutional diagram.
Fig. 4. RFID anti-collision read-write equipment control method program step schematic diagram of the present invention.
Fig. 5. RFID anti-collision read-write equipment read write tag schematic flow sheet of the present invention.
Embodiment
Describe the present invention below in conjunction with embodiment and accompanying drawing, these descriptions are not that content of the present invention is further limited.
embodiment 1 RFID anti-collision read-write equipment
As shown in Figure 1, RFID anti-collision read-write equipment of the present invention comprises an input equipment, two output devices, a read-write chip, a digital machine, and input equipment, output device, read-write chip all are connected with digital machine.Input equipment is matrix keyboard, input to digital machine for the data that will write label, two output devices are respectively LCD display device and UART communication facilities, the LCD display device is for showing flow process and the result of the operation of RFID anti-collision read-write equipment, and the UART communication facilities is for being transferred to read data transfer the order of this device to subordinate equipment or reception subordinate equipment.Read-write chip is to follow the read-write chip MFRC522 of ISO/IEC 14443 agreements, the anti-collision algorithms of read-write chip based on the BIT collision detection protocol, and read-write chip just can be carried out the identification of next label after successfully identifying certain label.Read-write chip is accepted the instruction and data of digital machine, and instruction and data is acted on corresponding label or obtains data from label and pass to digital machine.
The needed parameter of digital machine memory storage, and the information of processing input equipment and read-write chip MFRC522 submission.Digital machine stores the label anti-confliction running program of read-write chip BIT collision detection protocol, ISO/IEC 14443 protocol definitions.The tag operational mode of digital machine is finite state machine, after label receives a request command of read-write equipment, its state will be corresponding to certain state in finite state machine, if the success of label response command or failure directly jump to corresponding state and enter next step processing.Digital machine comprises a microprocessor main control chip, its structure as shown in Figure 2, microprocessor main control chip storage tags anti-collision running program, finite state machine mode of operation and other running programs.The CPU (central processing unit) that the microprocessor main control chip comprises an integrated circuit (CPU) is for example the MCS-51 8 bit parallel processing units on single LSI chip.This CPU is connected RAM, FLASH, I/O, EEPROM with address bus by data bus, and realize that by control bus all parts works in an orderly manner, when by after microprocessor main control chip and MFRC522 chip portfolio, once have label to enter in the antenna range of MFRC522 chip, this device just can operate all labels successively.
In embodiment, with the computer control system of the anti-collision read-write equipment of the non-contact IC card of following ISO/IEC 14443 agreements, BIT collision detection protocol, conceived, reduce the artificial intervention to the label operations, program has been used finite state machine to the operation of label, the discrimination of raising label >=99%.The present embodiment device can be used for IC-card, consumption card with the device apart from 10cm, read this card label.
embodiment 2 RFID anti-collision read-write equipment control methods
As shown in the constitutional diagram of Fig. 3 RFID anti-collision read-write equipment control method, when label enters in the antenna reach of this device, now label is in power-down state (POWER OFF state).After then label can carry out a reset operation, its state-transition is idle condition (IDLE State).Label in idle condition (IDLE State) is waited for the request-reply order (REQA Command) of read write line, representing that anti-collision is successful if label response request acknowledgement command (REQA Command) is successful, and got the ID of certain label, now, label is in ready state (READY State).Utilize the label ID got previously, reading device continues to send select command (SELECT Command), selecteed label enters state of activation (ACTIVE State) thereupon, and under this state, read-write equipment can be to operations (Application) such as label read-writes.After EO to label, reading device can send a dormancy instruction (HALT Command) to label, the label that receives this order enters dormant state immediately, until receive wake command (WAKE-UP Command) order that read-write equipment sends.
Based on Fig. 3 unit state figure, as shown in Figure 4, complete fundamental purpose algorithm routine step of the present invention, whole program step is all that a series of dependent instructions that are stored on digital machine Flash by execution complete.After the operator opens this cover system, at first controller carries out initialization to each hardware module, comprising: MFRC522 read-write chip, LCD display device, UART serial communication apparatus.Subsequently, read-write equipment is carried out the operation of seeking label, anti-collision, selection label, read write tag, dormancy label to the label entered in its antenna range successively.If the some operation stepss in whole flow process are carried out unsuccessfully, program is at once returned and is re-executed this operation, until this operation runs succeeded.
RFID anti-collision read-write equipment read write tag schematic flow sheet as shown in Figure 5, the operating process of read write tag read write tag is: at first, program judgement select selected label after tag operational be carry out read tag operational or writing labels operation, if neither execution is read tag operational and is not also carried out the writing labels operation, just directly exit read-write state, wait for and receive the dormancy instruction.
Read tag operational if carry out, read-write equipment can send and read label instructions to selected label, label just returns to read-write equipment by the data of designated address space after receiving this instruction, read-write equipment is presented at it on LCD display device after getting the data that label returns, and by the UART communication facilities, the data of obtaining is sent to subordinate equipment.When label fail correctly to receive read-write equipment read label instructions the time, read-write equipment can repeat to send this and read label instructions, until label correctly receives this instruction return data, after reading tag operational and completing, label is waited for and is received the dormancy instruction.
If carry out the writing labels operation, program judges whether the data input buffer district is empty, if it is empty, on the LCD display device, export warning message, the prompting user input data, if judgement data input buffer district is that read-write equipment sends the writing labels instruction to selected label not for empty, and the data that will input data buffer write and are selected the corresponding address space of label.When label fails correctly to receive the writing labels instruction of read-write equipment, read-write equipment can repeat to send this writing labels instruction, until label correctly receives this instruction and the data in data input buffer district is written to the corresponding address space of label, after writing labels has operated, label is waited for and is received the dormancy instruction.
When ought only have a label (IC-card, consumption card) to appear in the antenna reach of this read-write equipment in the present embodiment, this apparatus control method is the same with traditional read-write equipment, can carry out operation such as read-write grade to this label.In the time of in the antenna reach that simultaneously appears at this read-write equipment more than a label is arranged, this device can be judged the generation of conflict, then carry out anti-collision operation, finally complete successively to the operation such as the read-write of these cards rather than as traditional read-write equipment to the user report mistake or only to operations such as certain label execution read-writes wherein.
The above embodiment of the present invention scheme is only can not limit the present invention to explanation of the present invention, pointed out the signal of the flow process of apparatus of the present invention constitutive characteristics, apparatus control method in claim, and the scope of parameter of the present invention is not pointed out in above-mentioned explanation, therefore, in the implication suitable with claims of the present invention and any change in scope, all be considered to be in the scope that is included in claims.