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

Accelerometer

Commander_BobCommander_Bob Posts: 17
edited 2007-06-27 00:32 in Propeller 1
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

  • Brian CarpenterBrian Carpenter Posts: 728
    edited 2007-06-26 21:26
    just my guess but % means binary value. Would it be 3?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    It's Only A Stupid Question If You Have Not Googled It First!!
  • Commander_BobCommander_Bob Posts: 17
    edited 2007-06-26 21:44
    11 in binary is 3. That would make more sense because %11 is only 2 bits so \2 makes sense too. Can anyone confirm this?
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-06-26 21:54
    I've looked through the code and have not been able to find %11\2 anywhere?

    Are you sure you didn't just lean on the keyboard? The only use for \ I can find is for abort traps.

    Graham
  • Commander_BobCommander_Bob Posts: 17
    edited 2007-06-26 22:54
    Here is the section of code
    Get_H48C:
    LOW CS
    SHIFTOUT Dio, Clk, MSBFIRST, [noparse][[/noparse]%11\2, VRef\3] ' select vref register
    SHIFTIN Dio, Clk, MSBPOST, [noparse][[/noparse]rvCount\13] ' read ref voltage counts
    HIGH CS
    PAUSE 1
    LOW CS
    SHIFTOUT Dio, Clk, MSBFIRST, [noparse][[/noparse]%11\2, axis\3] ' select axis
    SHIFTIN Dio, Clk, MSBPOST, [noparse][[/noparse]axCount\13] ' read axis voltage counts
    HIGH CS
    RETURN
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-06-27 00:11
    I had assumed you were refering to the spin code:

    http://forums.parallax.com/showthread.php?p=605387

    Given that this is the propeller forum not the basic stamp forum.

    Graham

    Post Edited (Graham Stabler) : 6/27/2007 12:16:00 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-27 00:32
    Yes, the notation "%11\2" is PBasic, not Spin.· In PBasic, in the SHIFTOUT (and similar) statement, the "%11" is indeed binary and the value is 3.· The "\2" is a bit count for the SHIFTOUT (look in the PBasic manual under SHIFTOUT and SHIFTIN·for details).
Sign In or Register to comment.