Shop OBEX P1 Docs P2 Docs Learn Events
highbyte lowbyte — Parallax Forums

highbyte lowbyte

waltwalt Posts: 27
edited 2005-05-01 23:41 in Robotics
· What does highbyte and lowbyte mean or do in a program for BOE BOT.

Comments

  • KenMKenM Posts: 657
    edited 2005-05-01 17:02
    A word variable is 16 bits or two bytes. Each byte being 8 bits.

    Define a word $F0 or....

    %1111111100000000

    The high byte is %11111111

    The low byte is %00000000

    k
  • waltwalt Posts: 27
    edited 2005-05-01 19:48
    · Thank you that makes sense. Sure is nice to have you guys out there

    ····· walt blush.gif
  • waltwalt Posts: 27
    edited 2005-05-01 22:54
    ·why would you have to use this after pulsewith as in .

    ···· serout sdat, baud+$800, [noparse][[/noparse]"!sc", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, cr]


    This is a line from a program for a servo controler. In the program the veriable·for pw is a "word" please remember I am new at this.
    · ch·· VAR·· byte
    · pw· VAR·· word
    · ra·· VAR··· byte
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-05-01 23:41
    Walt,

    ·· Serial data transmission is done one BYTE at a time.· Since you're trying to send a Word, you must send it one BYTE at a time.· In this case, LOWBYTE then HIGHBYTE.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.