Shop OBEX P1 Docs P2 Docs Learn Events
Bigger than a byte — Parallax Forums

Bigger than a byte

NewzedNewzed Posts: 2,503
edited 2005-05-09 01:46 in General Discussion
The SX/B program I'm working on is generating a number larger than 255.· How do I handle this word-sized variable?· I've tried an array but couldn't make it work.

Sid

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-08 20:38
    You got to handle things manually.

    countLo··· VAR··· Byte
    countHi··· VAR··· Byte

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • NewzedNewzed Posts: 2,503
    edited 2005-05-08 21:00
    Jon, I'm trying read RCTime, so I don't what the values are going to be, and I can't read the result into two variables.· Would I be better off just using a byte variable, and changing the resolution to 4 or 5 or whatever to keep the value·less 255?

    Sid
  • NewzedNewzed Posts: 2,503
    edited 2005-05-08 21:03
    Ken, it is being generated by RCTime.· On the BS2P the numbers are plus or minus 1600.

    Sid
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-08 21:13
    The reason that SX/B's version of RCTIME has a resolution value is to allow the result to fit into one byte.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-08 21:16
    Not necessary, Ken -- one simply needs to adjust the Resolution parameter. This was added specifically to address this issue. If one needs additional resolution the SX/B output of RCTIME could be modified to handle multi-byte vars (you have to adjust the code and delay timers).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA


    Post Edited (Jon Williams) : 5/8/2005 9:20:28 PM GMT
  • BeanBean Posts: 8,129
    edited 2005-05-09 01:46
    Sid,
    If you need more acuracy, you can do RCTIME with a resolution of 4 or 5. Then if the value returned is low, then do RCTIME again without the resolution value (defaults to 1).

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video Display Module" Available Now.

    www.sxvm.com

    "I thought I was wrong once...But I was mistaken [noparse];)[/noparse]"
    ·
Sign In or Register to comment.