How in the world do i do this? Using MCP41xxx/$2xxx Digital Pots

buntay

Senior Member
Ok, I have a Frequency drive for a blower motor and I would like to control it with Picaxe.

Here is the datasheet on a digital pot http://che126.che.caltech.edu/11195c.pdf it is a single channel, 8 pin dip chip.

How in the world do I talk to this thing? I have read virtually everything I can find about SPI interfacing and manual 2 but I just dont get what, and how I am supposed to get Picaxe to make this thing work. is it a ascii string being sent? is it a binary being sent.....what? How do I get picaxe to set the wiper at step #25 or #130 or #222

Please dont post a bunch of links, as I have probably already read it.

A simple, explained, piece of code would help.

I would be ever grateful for anybody that can help me understand this since it is an industry standard.
thanks
F.
 
Last edited by a moderator:

rossko57

Senior Member
is it a ascii string being sent? is it a binary being sent.....what? How do I get picaxe to set the wiper at step #25 or #130 or #222
The data sheet is quite explicit that it wants you to send two bytes.
The first byte is the command byte, the datasheet explains the various bit significance.
The second byte is the data, the value to assign to a pot (if it is a pot-setting command) or just ignored for some commands - but must always send that second byte.

Two areas for you to explore then:
How to send two bytes via SPI
What values to give those bytes for this device.
 

buntay

Senior Member
so according to the datasheet and the thread westaust55 pointed through. is this a start?
Code:
b0=0
b2=%00010001 'command byte %xx(dont care),01(command),xx(dont care),01(channel select)

main:
if b0=>255 then let b0=0: end if
b1=b0+1
low c.3' CS pin
spiout C.1,C.2,1, (b2 / 8,b1 / 8)
high c.3
b0=b1
pause 200
goto main
if im right this will increase the wiper 1 step till it gets to 255, then start over from 0.
It passes syntax.
 

buntay

Senior Member
20x2. I know it has hardware spi but I'm trying to wrap my head around what actually needs to be sent and understand how it all works.
 
Top