Sorry. I didn't post the code correctly last time. Here it is again. Basically what I want to know is why does this work just fine on the MCP4231, but not on the MCP4251?
Code:
'
' Hardware configuration
' ======================
TRISC=0
'
' Hardware connection
' ===================
CS VAR PORTC.0
CLK VAR PORTC.1
SI VAR PORTC.2
'
' Variables definition
' ===================
Wiper var byte
'
' Constants definition
' ====================
MSBFIRST CON 1
WriteOnPot0 con 000001
WriteOnPot1 con 010001
'
' Software/Hardware initialisation
' ================================
cs = 1 ' disable MCP
PAUSE 100 ' safe settle time
Start:
for wiper = 0 to 255
cs=0 ' enable
shiftout si,clk, MSBFIRST,[WriteOnPot0, WIPER] ' Write to MCP first address
shiftout si,clk, MSBFIRST,[WriteOnPot1, WIPER] ' Write to MCP second address
cs = 1 ' Disable
pause 10
next
goto start
Bookmarks