Shop OBEX P1 Docs P2 Docs Learn Events
concatenate ascii characters to decimal — Parallax Forums

concatenate ascii characters to decimal

shmowshmow Posts: 109
edited 2008-07-15 13:23 in Propeller 1
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

Comments

  • TimmooreTimmoore Posts: 1,031
    edited 2008-07-15 04:23
    Start with count = 0
    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")
  • shmowshmow Posts: 109
    edited 2008-07-15 13:23
    Thanks Timmoore, I'll try it out.
    Regards,
    Shmow
Sign In or Register to comment.