O.K it's untested but it should work for any MCP4XXXX digital pot. Try it and post your results
Now connect PA0 too vcc, PB0 to GND and read the voltage on PW0 pin... is this working?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 %00010001 ' ' 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 cs = 1 ' Disable pause 10 next goto start




Bookmarks