IC card how to read and write two consecutive blocks in the data
Time:10-15
M1 card, a total of 16 sectors (0 ~ 15), each sector four piece (0 ~ 3), the third piece of stored passwords, and so each block can be used three fast, every piece of 16 bytes of data can be stored, too little, only eight characters, now want to put two or three consecutive, speaking, reading and writing, such as realization of 4 and 6 pieces of three data block (that is, sector 1) data write and read, how to implement? Idea is: with LenB () returns the byte length, the first 16 bytes goes into 4 pieces, 17 ~ 32 bytes to 5 pieces, the back of the store to 6 pieces, The code below is wrong, but it is the meaning of the above, seek help from a great god! Sector=1/select sector 1 St=rf_authentication (icdev, 0, sector) [to verify this sector 1, the return value is zero, the authentication is successful, the function of the secondary development kit] If (st=0) Then 'List1. AddItem (rf_authentication "ok") The Else MsgBox "sector 1 validation failed!" , vbCritical The Exit Sub End the If Data1=Trim (Text1. Text) [to assigned to the characters in Text1 data1] If LenB (data1) & gt;=0 And LenB (data1) & lt;=16 Then [when input between 0 ~ 16 bytes in length, are all written in block 4] St=rf_write (icdev, 4, data1) Else [or write 16 bytes before 5, at the back of the written piece of 6] St=rf_write (icdev, 4, MidB (data1, 1, 16)) And st=rf_write (icdev, 5, MidB (data1, 17)) End If
CodePudding user response:
Between reader and M1 card has a full set of protocols, probably can't realize your ideas, My understanding is the M1 card itself declined to a read/write multiple blocks, although M1 card is not intelligent, but also better than 4428-4412, is more complicated, how not to can, must follow its agreement,
CodePudding user response:
Data to determine the length of the in front, and then be put certification, write,
CodePudding user response:
The original poster is a unit with me yo, ha ha,
Feel the building and development of the IC card now, the development of the IC is same with me, (whether shenzhen huaao han Ming technology of IC card, look at that function is very much like)
I is such operation, a sector four blocks, can only write one, two, three, the fourth block is MiMa District regardless of it,
The IC may write and read the two sides agreed to good (such as when you wrote each other after reading to read as you write rules, such as which a few area which a few pieces of what is written information),
Two ways to write: 1. The first checks to write the length of the string, if more than eight characters will take over again and then write a second piece of; 2. Regardless of the length of the character, the appointment (such as the first sector I only write the name of the company), I don't care what is the length of the name of the company (but not more than 24, for a sector most write three blocks, a block 8 Chinese characters), I put it all into three sectors, the first eight characters written 1, 8 characters into two pieces, in the remaining 3 - write this kind of writing, is no more than eight when all the strings, also won't go wrong, just behind the two piece of writing is all empty,