Home > Software engineering >  IC card how to read and write two consecutive blocks in the data
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,

Using the thinking of how to see you.

CodePudding user response:

The
reference 3 floor wangyuzg 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,

Using the thinking of how to look at you,

Has achieved, the basic train of thought with you, but I didn't judge character length, we need record three data card, I put the three data respectively in three areas, each area have 3 blocks can be used, each corresponding to a text box, the 1 ~ 16 characters written to the first text box, 17 ~ 32 wrote the second text box, 33 ~ 48 wrote the third text box, the last three text boxes display connection, of course the three text boxes runtime invisible,

CodePudding user response:

The
reference 3 floor wangyuzg 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,

Using the thinking of how to look at you,

Write the first sector of the code:
St=rf_write (icdev, 4, Mid (data10, 1, 8))
St=rf_write (icdev, 5, Mid (data10, 9, 16))
St=rf_write (icdev, 6, Mid (data10, 17, 24))

CodePudding user response:

understand the wrong I mean
Thought the original poster wants to write multiple blocks at a time, the original poster is to more than one continuous piece of splicing a data string,
Ha ha

CodePudding user response:

reference 5 floor ZJ_Star reply:
write the first sector of the code:
St=rf_write (icdev, 4, Mid (data10, 1, 8))
St=rf_write (icdev, 5, Mid (data10, 9, 16))
St=rf_write (icdev, 6, Mid (data10, 17, 24))


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Adversary, is such, even if the Mid (data10, 9, 16)="", Mid (data10, 17, 24)=" "(which is only eight or the string data10 & lt; Eight, the statements above will not make a mistake, no problem, when the write also read out when he read is null)

Where is the original poster?

CodePudding user response:

refer to 7th floor wangyuzg response:
Quote: refer to fifth floor ZJ_Star response:


Write the first sector of the code:
St=rf_write (icdev, 4, Mid (data10, 1, 8))
St=rf_write (icdev, 5, Mid (data10, 9, 16))
St=rf_write (icdev, 6, Mid (data10, 17, 24))


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Adversary, is such, even if the Mid (data10, 9, 16)="", Mid (data10, 17, 24)=" "(which is only eight or the string data10 & lt; Eight, the statements above will not make a mistake, no problem, when the write also read out when he read is null)

Where is the original poster?
shanxi, interpret their mulling over a person, and now have a new problem, look at me in the BBS framework - VB database development language/send another post, [question about VB code database, are interested in, look at]

CodePudding user response:

refer to 6th floor yachong response:
understand the wrong I mean
Thought the original poster wants to write multiple blocks at a time, the original poster is to more than one continuous piece of splicing a data string,
Ha ha
ha ha, is a piece of writing too much data, so the thinking of a data record into the multiple blocks, so record data is much

CodePudding user response:

Actually can also write to judge the length of the characters, but more troublesome, so I used the lazy way,
  • Related