Shop OBEX P1 Docs P2 Docs Learn Events
Help interfacing with a MCP4261 digital pot (SPI) — Parallax Forums

Help interfacing with a MCP4261 digital pot (SPI)

achilles03achilles03 Posts: 247
edited 2009-01-30 15:44 in BASIC Stamp
I'm trying to interface with a dual channel digital pot (MCP4261), and can't get it to work. I've accessed just about everything else that uses SPI, but for some reason I'm having trouble with this chip:

http://ww1.microchip.com/downloads/en/DeviceDoc/22059b.pdf
(The meat of the SPI info is between pages 42 and 47)

I keep measuring 100k resistance across one side of the tap, and 0 across the other (both channels). I can't figure out what I'm doing wrong. The chip is connected to the pins via 10k resistors, and the LED works as it should. Vss and Vdd are connected, and everything else is floating. The BS2 pins aren't burned out, and I've tried a different stamp with the same results. Here's my code:

res var byte
Command var WORD

CS con 1
CLK con 2
SI con 3
LED con 4

high CS
high LED
pause 500
low LED
pause 500
high LED

res=24

repeatit:
command.highbyte=0
comand.lowbyte=res
low CS
shiftout SI,CLK,MSBFIRST,[noparse][[/noparse]command\16]
high CS

pause 10

Command.HighByte=%00010000
low CS
shiftout SI,CLK,MSBFIRST,[noparse][[/noparse]command\16]
high CS

pause 500
res=res+32

goto repeatit

No change in resistance while this program is running.

Any advice is greatly appreciated!

Dave

Comments

  • metron9metron9 Posts: 1,100
    edited 2009-01-30 06:45
    I think you forgot about the mode in the shiftout command. Check your idle state of the sck pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • achilles03achilles03 Posts: 247
    edited 2009-01-30 15:44
    I think I figured out the problem. I switched the 10k resistors with 500 ohm resistors and viola! It worked. There must be some internal pull-up or pull-down resistors on the digital pot that prevented the pins from reaching the appropriate logic states with the 10k resistors.

    Dave
Sign In or Register to comment.