Ok. I found my problem. If anybody needs this...
Thanks to meCode:WriteSPI: GOSUB GetPotVal CS = 0 ' Enable Shiftout SI, SCK, MSBFIRST, [$11, UpdPotVal] CS = 1 ' Disable![]()
Ok. I found my problem. If anybody needs this...
Thanks to meCode:WriteSPI: GOSUB GetPotVal CS = 0 ' Enable Shiftout SI, SCK, MSBFIRST, [$11, UpdPotVal] CS = 1 ' Disable![]()
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
Do you have a pull-up resistor on PORTA.4?
It has an "Open collector" output, and can't go HIGH by itself.
<br>
DT
Garsh, I think that's it. I knew there was something about one of the pins I was forgetting. I'll try that tonight and see what happens.
So long as I use the CMCON=7 command, is porta.4 the only tricky pin I need to worry about? I also set the configuration byte to disable everything.
Thanks!
Dave
Bookmarks