I know this thread is a little old, but I'm having a similar problem writing to a MCP41010. I've breadboarded it, and I know the PIC (16F628A) is working because the LED works as it should (I always put that in to make sure the chip's actually operating and running the program).
Here's the datasheet for the MCP41010:
http://ww1.microchip.com/downloads/e...Doc/11195c.pdf
Here's the relevant code:
-----------------------------------------------------
cmcon=7
define osc 8
res var byte
command var byte
SI var porta.4 'SI
CLK var porta.3 'CLK
CS var porta.2 'CS
LED var porta.1 'LED
high porta.2
command=19
high LED
pause 1000
low LED
pause 1000
high LED
repeatit:
res=256
low CS
shiftout SI,CLK,1,[%00010011\8,res\8]
HIGH CS
pause 5000
res=128
low CS
shiftout SI,CLK,1,[command,res]
HIGH CS
pause 5000
goto repeatit
end
-----------------------------------------------------
I've tried entering the command like both as binary and a variable to see if that has any effect, but the chip consistently reads 4.7kOhm.
Any advice or help is appreciated!
Dave





Bookmarks