Shop OBEX P1 Docs P2 Docs Learn Events
Can the BS2 accept Signed Two's Complement? — Parallax Forums

Can the BS2 accept Signed Two's Complement?

dodgerdodger Posts: 37
edited 2008-10-30 17:56 in BASIC Stamp
I've noticed that there is a SDEC function, but is the same as Signed Two's Compliment?· If not can the BS2 accetp Singed Two's Compliment data?

Thanks

Comments

  • skynuggetskynugget Posts: 172
    edited 2008-10-30 17:46
    hey dodger see if this posts helps you out.

    http://forums.parallax.com/showthread.php?p=731449
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-30 17:56
    SDEC is used to translate external data (like to or from a serial port) that's signed into the internal byte or word format used by the Stamps. Most arithmetic is done on 16 bit unsigned integers (with values from 0 to 65535). You can use the same 16 bit words for signed 2's complement numbers (with values from -32768 to 32767) and most of the arithmetic operators will work properly (like +, - and *). Division will not (read the Manual description of the operators).
Sign In or Register to comment.