Shop OBEX P1 Docs P2 Docs Learn Events
Accelerometer — Parallax Forums

Accelerometer

Commander_BobCommander_Bob Posts: 17
edited 2007-06-27 07:59 in BASIC Stamp
In the demo code for the· Hitachi H48C TriAxis Accelerometer Module does any one know what %11\2 means? I think \2 means 2 bits but what is %11? I am trying to use the accelerometer and I am writing the code in C so I need to know what this means. Does it have a hexadecimal equivalent that could be sent to the chip?
Thanks

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-06-27 04:49
    As in -- SHIFTOUT Dio, Clk, MSBFIRST, [noparse][[/noparse]%11\2, axis\3] ??
    %11 is PBASIC for binary 11 (which is decimal '3')
    \2 is PBASIC, too, telling the STAMP that it'll SHIFTOUT two bits.

    The axis variable is 3 bits.
    If it was %1010\4 then it'd send out binary 1010 (decimal '10') with the further notation to SHIFTOUT 4 bits.

    So you tell it the number to send and how many bits it is.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-06-27 07:59
    PJ -

    Not to be picky, but the word "number" could be misunderstood when you said:

    "So you tell it the number to send and how many bits it is."

    Might be better stated as:

    So you tell it the value to send and how many bits it is.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sign In or Register to comment.