Summary of the invention
It is an object of the invention to overcome the deficiencies in the prior art, it is anti-that the present invention provides a kind of conflict position based on Type A
Collision method is used by the way that an ANTI order and original SEL collocation is added, reduces and send data volume, reduce card and need
The data volume of judgement, to reduce recognition time.
In order to solve the above-mentioned technical problem, the technical solution of this programme are as follows:
A kind of conflict position anti-collision method based on Type A, which comprises
After card receives the SEL+NVB order of reader transmission, the card successively sends UID number to the reader
According to;
The reader receives UID data, and judges UID data with the presence or absence of conflict;
If it exists, identification UID conflict position T+1, by low 7 bytes of the value write-in ANTI of T+1;
The reader sends the order of SEL+ANTI anti-collision to the card, for feeding back the low of ANTI to the card
7 bytes are the position T+1 of UID data;
The card judges T+1 judge whether the T+1 is 1, if then according to SEL+ANTI anti-collision order
UID is sent since T+1, otherwise enters idle state;
If it does not exist, it completes to receive UID data.
Applied to the existing Type A in binary system tree-shaped searching algorithm after clashing, need to conflict position assignment
Afterwards, then with the UID having been received card, this mode deficiency long there are recognition time, due to card sheet are sent jointly to
The UID of body be for reader it is unknown, set 0 when conflicting position assignment or set 1 and be not different, so directly providing all
It is 1 card that conflict, which just selects conflict position, finally can still choose a card.The technical program needs UID to add for original
Conflict position just can determine which card is selected, be revised as only needing to judge to conflict position can card selection piece, reduce the transmission of data volume, subtract
The data volume that few card needs to judge, to reduce recognition time, (i.e. reader is rushed neither to conflict position assignment without sending
The value of prominent position, it is only necessary to send order and tell card is which bit swiping of UID, the card that conflict position is 1 will be from conflict position
Start to send remaining UID to reader, reader has also just read the value of this conflict position, liquidates since reader reduces
Prominent position assignment and the operation sent naturally also just reduce the time of identification).
Preferably, the method also includes:
The card receives after first byte is SEL order, by judging described in a data determination of second byte
Order is SEL+NVB order or SEL+ANTI anti-collision order.
Preferably, a data by judging second byte determine the order for SEL+NVB order or
SEL+ANTI anti-collision order, comprising:
The a data of second byte is judged for 0, then the order is SEL+NVB order;
The a data of second byte is judged for 1, then the order is the order of SEL+ANTI anti-collision.
Preferably, the identification UID conflict position T+1, comprising:
The reader often receives one of UID data, and the counter in the reader adds one;
When the reader receives UID data transmission collision, the reader stops receiving UID data;
It obtains the counter and counts T, then UID conflict position is T+1.
In the technical scheme, for reader during receiving UID, counter T is just added 1 by every reception a data,
When the conflict occurs, it is T+1 that counter T value+1, which just represents the conflict position of UID, only need to judge that the value of this can be selected
Card operation.
Preferably, it is described into idle state be will conflict judgement after be not selected be placed in idle state;This skill
Not selected card is placed in idle state after each conflict judgement by art scheme, can prevent its quilt when conflicting next time
It chooses.
Compared with prior art, beneficial effects of the present invention:
1) present invention needs UID that conflict position is added just to can determine which is selected block by original, and the position that is changed to only to need to conflict is i.e. optional
Card, can simplify operational order, and an ANTI order is added in original Type A agreement and original SEL collocation uses, subtracts
Data volume is sent less, the data volume that card needs to judge is reduced, to reduce recognition time.
2) present invention is when the conflict occurs, after which bit swiping reader tells to card by SEL+ANTI order,
Card directly selects the card that the conflict position is 1, sends remaining UID to reader since the position that conflicts.In this process
Reader neither to conflict position assignment, does not need the value for the position that conflicts being sent to card yet, it is only necessary to receive conflict position in UID
Location information, reduce reader to the assignment operation of conflict position and the value for the position that conflicts be sent to card by antenna
The step of piece, reduces the transmission of data volume and the energy consumption of antenna, while reducing recognition time.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that the described embodiment is only a part of the embodiment of the present invention, instead of all the embodiments.Based on this
Embodiment in invention, all other reality obtained by those of ordinary skill in the art without making creative efforts
Example is applied, shall fall within the protection scope of the present invention.
Fig. 1 is the flow diagram of the conflict position anti-collision method in the embodiment of the present invention, as shown in Figure 1, the method
Include:
S11: after card receives the SEL+NVB order of reader transmission, card successively sends UID data to reader;
S12: reader receives UID data, while judging that UID data with the presence or absence of conflict, then enter S13 if it exists;It is no
Then enter S16;
S13: identification UID conflict position T+1, by low 7 bytes of the value write-in ANTI of T+1;
S14: reader sends the order of SEL+ANTI anti-collision to card, for low 7 bytes to card feedback ANTI
For the position T+1 of UID data;
S15: card judges T+1 judge whether T+1 is 1 according to SEL+ANTI anti-collision order, if then from
T+1 start to send UID, otherwise enter idle state;
S16: it completes to receive UID data.
S11 is described further:
Firstly, when card is close to reader, reader sends REQA order, for that will be in the card wake-up of idle state
For READY state, allow to respond the order of reader;Card sends ATQA after being connected to REQA order, to reader,
The anti-collision type of card UID length and card is contained inside ATQA;Reader inspection sends back the ATQA order come, obtains
The length (0-4 byte, 0-7 byte, 0-10 byte) of UID, and determine card is using which kind of anti-collision type in launching site.
Reader sends the SEL+NVB order for reading UID, and SEL order CL1 is first read since UID first part, and SEL has
Three values CL1, CL2, CL3 respectively indicate three parts for reading UID, and UID points are 0 ~ 4 byte of first part, 5 ~ 7 word of second part
Section, 7 ~ 10 byte of Part III.NVB there are two be worth " 20 " and " 70 ", NVB be equal to " 20 " when combined with SEL, expression card from
UID first starts to send to reader;After card is connected to SEL+NVB order, card successively sends UID(card to reader
Piece sequence number).
S12 is described further:
Reader receives the UID data that card is fed back, and is receiving UID data simultaneously, is judging whether the UID data deposit
Conflicting.
S13 is described further:
Reader often receives one of UID data, and the counter in reader adds one;Reader receives UID data hair
When sending conflict, reader stops receiving UID data;It obtains counter and counts T, then UID conflicts position for T+1;Then will conflict position T
Low 7 bytes of+1 value write-in ANTI.
Reader receives the UID data that card is sent back to, and is often connected to a UID data counter and voluntarily adds one, if not sending
Collision, then receive a complete UID data, if colliding, by having received T data known to counter, also
Know it is T+1 bit swiping;Then by low 7 bytes of the value write-in ANTI for the position T+1 that conflicts, the ANTI order such as following table institute
Show:
S14 is described further:
The rows of anti-collision order SEL+ANTI of shape in reader, the reader send SEL+ANTI erosion control to the card
Prominent order, for being the position T+1 of UID data to low 7 bytes of card feedback ANTI.
S15 is described further:
Card automatically carries out T+1 after being connected to SEL+ANTI anti-collision order, according to the order of SEL+ANTI anti-collision
Multilevel iudge judges whether T+1 is 1, if multilevel iudge result T+1 is 1, UID is sent since T+1, if multilevel iudge T
+ 1 is not 1, then the card enters idle (IDLE) state, and the card into idle state no longer responds anti-collision order;Into
Idle state be will conflict judgement after be not selected be placed in idle state.
If occurring conflict situation again in above-mentioned process, S13-S15 step is recycled.
S16 is described further:
If no longer occurring conflict phenomenon in above-mentioned steps, complete to receive UID data.
In above process, card needs to detect a data for receiving second byte that first byte is SEL order
It is SEL+NVB order or SEL+ANTI anti-collision order that order, which could be distinguished, wherein a data of second byte is 0,
Then indicate that order is SEL+NVB order;The a data of second byte is 1, then order is the order of SEL+ANTI anti-collision.
Fig. 2 is the flow diagram of the conflict position anti-collision method in further embodiment of this invention, detailed process are as follows:
What S201:SEL was indicated is which part for reading UID, and the value that when beginning is SEL is 93, represents first for reading UID
Point;
S202: the value of NVB is set as 20;
S203: SEL+NVB order is sent to card;
S204: after card is connected to SEL+NVB, UID is successively sent to reader;
S205: reader successively receives UID, while judging UID with the presence or absence of conflict, if so, into S206, if it is not, then
Into
S206: reader counts received UID according to self-contained counter, and acquisition has received UID
Number T;
S207: having received digit T according to reader, and obtaining conflict position is T+1, by low 7 bytes of T+1 write-in ANTI
In, i.e., it will be in low 7 of T+1 write-in ANTI;
S208: reader sends the order of SEL+ANTI anti-collision to card;
S209: card is connected to SEL+ANTI anti-collision order, judges whether the position T+1 of UID is 1, if 1, into S210,
If not 1, then the card enters idle state;
S210: sending UID since T+1, judge whether to conflict, if so, S206 is returned to, if it is not, into S211;
S211: having received UID, sets 70 for NVB;
S212: reader sends SELECT, and wherein SELECT is made of following table:
SEL |
NVB |
UID |
CRC |
1 byte |
1 byte |
4 bytes |
1 byte |
S213: after card receives SELECT order, SAK is returned to by card, reader is connected to SAK and then illustrates to receive now
The UID arrived is whole UID, if reader is not connected to SAK, then it represents that received UID is imperfect, needs to continue to UID.
In embodiments of the present invention, it needs UID that conflict position is added just to can determine which card selected for original, is changed to only need to conflict
Position can card selection, can simplify operational order, ANTI order and original SEL collocation be added in original Type A agreement
It uses, reduces and send data volume.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of above-described embodiment is can
It is completed with instructing relevant hardware by program, which can store in computer readable storage medium, and storage is situated between
Matter may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access
Memory), disk or CD etc..
It is carried out in addition, being provided for the embodiments of the invention a kind of conflict position anti-collision method based on Type A above
It is discussed in detail, herein should be using a specific example illustrates the principle and implementation of the invention, above embodiments
Explanation be merely used to help understand method and its core concept of the invention;At the same time, for those skilled in the art,
According to the thought of the present invention, there will be changes in the specific implementation manner and application range, in conclusion in this specification
Appearance should not be construed as limiting the invention.