You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which architecture are you using? 8-bit AVR or 32-bit processor? There is limited support for 64-bit numbers in the AVR implementation in the Arduino environment. It seems that e.g. strtoll() (note the double 'L') is not available; in which case you need to roll your own. And there is no print function to print 64-bit numbers as a any text representation.
Unless I switch to another microcontroller to use the strtoll function.
Your magic code led me to another solution.
Can you briefly explain the principle? Thank you very much.
The text was updated successfully, but these errors were encountered:
I spent some time figuring this out today in case you still want to know or any one else is confused.
hexInDec is taking the value sent by the module as a HEX string (a string of ascii characters that represent the value in HEX) and converting it to a decimal number. For example, let look at the 4 bytes that represent the country code. The module will send the ascii string 6D30. The module sends the characters backwards so really its 03D6 and if we convert that to decimal it should be 982. So basically this function is looking at the character codes of each char in the string "6D30" and using them to compute the decimal value.
It needs to find the decimal value for each hex digit in the string:
6 -> 6
D -> 13
3-> 3
0 - > 0
Then it needs to multiply each by the appropriate power of 16 and add them:
(61)+(1316)+(3*(16^2))+(0*(16^3)) = 982
If that's still confusing I'd look for a resources that explains converting between two number bases. maybe this?
as for printing the large number I converted it to a uint64_t and used the print function described here
hope that makes some sense or at least points someone in the right direction.
I'm trying to build my self FDX-B reader today. Thanks for the code for reference.
First, I want to file a bug. In the FDX-B protocol, TagNumber is 38 bits, i.e. 12 decimal digits.
Apparently unsigned long is not enough, long long should be used.
https://www.instructables.com/Animal-Micro-Chip-Scanner-RFID-Reader-Arduino/ This friend did fix your code.
In Part of convert Hex to Dec, I’m trying to Use strtoll function first. But as mentioned here https://forum.arduino.cc/t/strtol-stuck-with-big-numbers/697074/3
Unless I switch to another microcontroller to use the strtoll function.
Your magic code led me to another solution.
Can you briefly explain the principle? Thank you very much.
The text was updated successfully, but these errors were encountered: