Shop OBEX P1 Docs P2 Docs Learn Events
Targetting registers on slave using basic stamp — Parallax Forums

Targetting registers on slave using basic stamp

HaiTramNinDongHaiTramNinDong Posts: 2
edited 2009-05-24 15:44 in BASIC Stamp
Does anyone know how to send data specific to the register on a slave using a BS2?

I have this accelerometer that has embedded registers. Its user manual has clear instructions of the address to target to read these registers using a external microcontroller and write information on these registers. However, I am pretty much stuck programming this as I cannot target the specific registers.skull.gif I know that there are ways to communicate with the accelerometer using the BS2, like shiftin, shiftout. But, I cannot seem to find a way to send information to registers specifically as these only target pins.

Better yet, does anyone know a way that I can not use these registers?

Pray tell me if you have the answer, I am doing a project using BS2 and I am really new to BASIC programming. turn.gif

Comments

  • vaclav_salvaclav_sal Posts: 451
    edited 2009-05-24 14:55
    Can you post a link to your accelerometer and snippet of your code?
    Vaclav

    ·
  • HaiTramNinDongHaiTramNinDong Posts: 2
    edited 2009-05-24 15:44
    My accelerometer is the 3g tri-axis accelerometer by Kionix. Its part number is KXPS5-3157. Here's the link to it, http://www.kionix.com/accelerometers/accelerometer-KXPS5.html. It has all the data sheets and stuff there.

    I am not sure of what code I should post, but here's the part where I think it can send the instructions.

    SHIFTOUT SDO,SCLK,MSBFIRST,[noparse][[/noparse]YOUT_L] YOUT_L bring the read address of the Y output
    SHIFTIN Y,SCLK,MSBPRE,[noparse][[/noparse]ACCY]

    I am just shifting out the address of the Y-axis output and hoping that it will give me a response. I think this is wrong though.
    Thanks for the reply.
Sign In or Register to comment.