Shop OBEX P1 Docs P2 Docs Learn Events
Digital Pot SPI Instructions. — Parallax Forums

Digital Pot SPI Instructions.

VitorVitor Posts: 13
edited 2007-01-29 16:59 in BASIC Stamp
I purchased a few digital pots to control the frequency of a sine wave generator and I did not realize (until I read the datasheet) that the digital pots I purchased use SPI interface, not what I was expecting.
This is what I got.
http://www.robotstore.com/download/241787.pdf
Does somebody have a sample of code to send the instructions to the digital pot?
I'm using a BS2 and I would like to connect 2 or more digipots to the same lines.
Thank you.


Post Edited (Vitor) : 1/27/2007 6:32:41 PM GMT

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-01-27 20:22
    Vitor -

    No worries, SPI is fine for use with the PBASIC Stamp.

    You use the SHIFTOUT instruction to set it or write to it, and the SHIFTIN instruction to read it (the EEPROM). The rest you can find in the PBASIC Reference Manual, or the PBASIC Help File, which also has some examples.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • basicstampedebasicstampede Posts: 214
    edited 2007-01-28 00:16
    For digital pots, I think SHIFTIN and SHIFTOUT should be fine.

    However, there are some SPI bus devices that simultaneously send and receive data.

    In those cases, you must "bit-bang" them.
  • VitorVitor Posts: 13
    edited 2007-01-29 16:59
    I learned the protocol to program the digipots with SPI communication. GREAT!!!
    Then I started looking for the digital pot to fit my circuit, 500K ohm, with 256 steps, SPI interface.
    I can only find 1M ohm (no problem), 256 steps, I2C interface.

    How is I2C different from SPI communication?
    Do I use the same command? SHIFTOUT

    Thanks in advance.
Sign In or Register to comment.