concatenate ascii characters to decimal
shmow
Posts: 109
Hello All,
I have two propellers communicating using a pair of·912MHz tranceivers.
The prop on the receiving end "captures" a six digit value; for example
the value sent by the one prop·is·"2", "5", "5" and the value received by
the other prop is 505353.
How do I get the receiving chip to convert this six digit value of 505353
to the decimal value of 255?
Regards,
Shmow
I have two propellers communicating using a pair of·912MHz tranceivers.
The prop on the receiving end "captures" a six digit value; for example
the value sent by the one prop·is·"2", "5", "5" and the value received by
the other prop is 505353.
How do I get the receiving chip to convert this six digit value of 505353
to the decimal value of 255?
Regards,
Shmow
Comments
from highest byte to lowest byte.
count = count * 10 + (byte - "0")
e.g.
count := 0
b := (received >> 16) & $ff
count := count*10 + (b - "0")
b := (received >> 8) & $ff
count := count*10 + (b - "0")
b := received & $ff
count := count*10 + (b - "0")
Regards,
Shmow