Help interfacing with a MCP4261 digital pot (SPI)
achilles03
Posts: 247
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
Dave