Shop OBEX P1 Docs P2 Docs Learn Events
Hex conversion — Parallax Forums

Hex conversion

dev/nulldev/null Posts: 381
edited 2009-07-10 22:31 in BASIC Stamp
Is there a simpler way to do this?

HexNum VAR Byte
DecNum VAR Byte

SHIFTIN blabla..., HexNum
DecNum = HexNum.NIB0 + (HexNum.NIB1 * 10)


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-10 03:09
    About the only thing simpler would be to use the same byte variable for everything like:

    Value VAR Byte

    SHIFTIN ...,Value
    Value = Value.NIB1*10 + Value.NIB0
  • dev/nulldev/null Posts: 381
    edited 2009-07-10 21:22
    That's actually how my code is, I was just doing the above to makeit descriptive.
    Thanks Mike.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • Mike2545Mike2545 Posts: 433
    edited 2009-07-10 22:31
    This may not be as easy, but once you know HEX it make working with it easier.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike2545

    This message sent to you on 100% recycled electrons.
Sign In or Register to comment.