1

I am new to the RFID Scene and Serial communication as well.

So I am trying to use the RC522 RFID module and I wrote in block 22 - 0x36 which is 6. I want to write a code where I take whatever is in block 22 - 0x36, convert it into a float - 6.00 and then do some addition or deduction for example 6.00-2.5 = 3.5 and then I want to rewrite the value of 3.5 into that same sector but of course, convert it back to HEX ASCII - 33 2e 35. I've tried quite hard to find the solution online but couldn't. So is this possible to do?

Thanks.

6
  • yes, it is possible to do ... do you have any real questions?
    – jsotola
    Commented May 19, 2020 at 18:47
  • 1
    why do you need to convert to hex? ... 0x36, 54, '6', 0b00110110 are all the same data ... the only difference is the human readable form ... it is like uno, one, ichi, eins all being the same thing
    – jsotola
    Commented May 19, 2020 at 18:51
  • can you provide a simple code then? I am having a problem with substracting the byte buffer with some number. Commented May 19, 2020 at 19:47
  • It is unclear to me, what exactly you have and what you want to do with it. Do you have a character buffer with hex in ASCII format? And then you wanto to make some float calculation to it? Please provide the code, that you already have. That would greatly help, since here the types of the variables are really important
    – chrisl
    Commented May 19, 2020 at 19:53
  • 1
    To be clear, what you want stored is ascii codes right? So it's not hex or bin or dec, everything in computers is stored as binary. If you store 0x12 in one slot and store 18 in another slot and compare then they are the same and in both cases 0b00010010 is what actually got stored.
    – Delta_G
    Commented May 20, 2020 at 22:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.