PDA

View Full Version : Digital Pot SPI Instructions.



Vitor
01-28-2007, 01:22 AM
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

Bruce Bates
01-28-2007, 03:22 AM
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 -->

basicstampede
01-28-2007, 07:16 AM
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.

Vitor
01-29-2007, 11:59 PM
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.