Shop OBEX P1 Docs P2 Docs Learn Events
BS1 Hex serial commands — Parallax Forums

BS1 Hex serial commands

PropNut1960PropNut1960 Posts: 23
edited 2013-02-27 13:23 in BASIC Stamp
How do I code a BS1 serial command where the receiving device needs"0xEB" sent. The "0xEB" is HEX format. The baud is 2400, 8 bits no-parity. I've tried several things but can't get it to work. I know the device is working, I can send commands from my PC and it responds. Any help on this is appreciated, thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-27 11:34
    That depends on what "0xEB" means. Do you mean a single byte with the value (in decimal) of 235 (which is the same as $EB or 0xEB) or do you mean the characters "0", "x", "E", and "B"?

    If the first, then you want: SEROUT <pin>,<Baud>,($EB)

    If the second, then: SEROUT <pin>,<Baud>,("0xEB")

    In Stamp Basic, you write hexadecimal values with "$" in front rather than with "0x" in front. HEX format is just a convention for humans to read.
  • PropNut1960PropNut1960 Posts: 23
    edited 2013-02-27 11:56
    In Stamp Basic, you write hexadecimal values with "$" in front rather than with "0x" in front.

    That was it, thanks Mike. I was under the assumption that "#" had to be used, I don't recall ever seeing "$". Guess I haven't done enough reading. Thanks again.
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-27 13:23
    The "#" actually converts the value to human-readable decimal notation like "9", "9" or "2", "1", "4" for display. The "$" just tells the Stamp Editor that the following constant is in hexadecimal notation using the characters "0".."9" and "A".."F". In the end, the Stamp Basic compiler just sees a numeric constant and it all gets compiled into the same information in the Stamp's EEPROM.
Sign In or Register to comment.