Hi everyone
I need to make a VI that receives 4-byte hexadecimal values as ASCII strings from a CAN-USB interface. I am using an Arduino CAN schield with a firmware that I have not personally written and that I still haven't access to. I do have a problem with the format in which I receive the values. To get the exact value I should add 0 in the middle of the values when missing.
I give an example to explain better.
I get the string:
2 8 D5 0 0 0 0 B 5 70 <CR><LF> (value: 46448)
I'd like to interpret it as:
2 8 D5 0 0 0 0 B 05 70 <CR><LF> (value: 722288)
I'll give another example.
I get the string:
2 8 D5 0 0 0 0 B 4 5 <CR><LF> (value: 2885)
I'd like to interpret it as:
2 8 D5 0 0 0 0 B 04 05 <CR><LF> (value: 721925)
The maximum value I can read in this case is 1000000 in any case.
After I have added the zeros where needed in order to have always groups of two characters I can make something as in the attached VI to get the number that I am looking for.
Does anyone have an idea what algorithm I can use? Thank you!
ASCII-HEX.vi