I believe you need to send a command byte before your data. I have never used this chip,
but have used a MCP42010. The digi-pot needs to know if you are reading or writing to it. Look at page 47 data sheet it is showing a 16bit command/data format.
It would probably be easy to send two bytes in a row while the CS line is low. First byte would be your
command byte and second your 8bit variable. Even if its only seven bits you need to send a zero to pad the 8th bit etc
Code:
PORTC.0 = 0
SHIFTOUT PORTC.1, PORTC.2, 1, [constant\8]
SHIFTOUT PORTC.1, PORTC.2, 1, [variable\8]
PORTC.0 = 1
PAUSE 100
Here is an example sending two bytes, no need for bits
http://www.picbasic.co.uk/forum/show...light=MCP42010
or like this
Code:
PORTC.0 = 0
SHIFTOUT PORTC.1, PORTC.2, 1, [constant,variable]
PORTC.0 = 1
PAUSE 100
Bookmarks