Quantcast
Viewing all articles
Browse latest Browse all 20577

BASCOM-AVR : SPI chip select bascom AVR : REPLY

Ok thought I undersood everything, but still my digipot doesn't work. I have connected a scope to measure the voltage devider and the voltage stays in the middle (like the datasheet subscribes when nothing is written in the register) Here is my code [code:1:3db5837fe8] $regfile = "m168def.dat" Config Spi = Soft , Din = Portb.2 , Dout = Portd.0 , Ss = Portd.2 , Clock = Portd.1 spiinit Dim Mcp(2) As Byte 'declare array Dim Comm As Byte Comm = &B00 01 00 11 'set command byte Mcp(1) = Comm 'write command byte to array Dim R As Byte Dim T As Integer T = 100 Do For R = 0 To 255 Step 10 'make the value move from min to max Mcp(2) = R 'write value to array Spiout Mcp(1) , 2 'write data to potmeter Waitms T Next R For R = 255 To 0 Step -10 'make the value move from min to max Mcp(2) = R 'write value to array Spiout Mcp(1) , 2 'write data to potmeter Waitms T Next R Loop [/code:1:3db5837fe8] Can anyone tell me what I'm doing wrong?

Viewing all articles
Browse latest Browse all 20577

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>