Hello Everybody,
I'm trying to use a mcp41010 digital potentiometer with an atmega168, programmed in bascom.
The datasheet states that two bytes need to be sent using spi. One command byte and one data bye. Without changing the chip select between the two bytes.
http://ww1.microchip.com/downloads/en/d ... 11195c.pdf
On the bascom site I found the following example code which seemed useful to me:
Config Spi = Soft , Din = Pinb.0 , Dout = Portb.1 , Ss = Portb.2 , Clock = Portb.3
Spiinit
Dim a(10) as Byte , X As Byte
Spiout A(1) , 5 'send 5 bytes
Spiout X , 1 'send 1 byte
A(1) = Spimove(5) ' move 5 to SPI and store result in a(1)
End
My question about this code is: Does the chip select change during the Spiout command? In other words: will chip select change after one byte is sent?
The mcp41010 always needs multiples of 16 clocks while CS is low or commands will abort.
Greetings and thanks in advance
[b:b579f28079][color=red:b579f28079](BASCOM-AVR version : 2.0.7.6 )[/b:b579f28079][/color:b579f28079]
↧