HankMcSpank
- 9th September 2010, 00:28
Well, after a bit of to-ing & fro-ing, I've managed to get my digital pot controlled via a PIC using SPI.
One puzzlement disappears (how to get SPI working), but another one surfaces ........... I bought a 257 position pot (an MCP44251 - http://ww1.microchip.com/downloads/en/DeviceDoc/22060b.pdf ) *But* check this out.
If I send this...
command = %00000000 (ie a write command)
r_value = %111111111 (ie 'a wiper value of 255' or just 2 away from the 257 step maximu value) I see this...
http://img409.imageshack.us/img409/9480/36257420.jpg (http://img409.imageshack.us/i/36257420.jpg/)
(green trace is the input to the pot, yellow trace is the wiper out)
In other words, the signal is nowhere near maximum?
If I send it this...
command = %00000001
r_value = %10000000
It gets a little bigger...
http://img175.imageshack.us/img175/5715/81977059.jpg (http://img175.imageshack.us/i/81977059.jpg/)
I *can* actually get the wiper output signal to maximum (ie output = to the input signal) by sending this to the pot...
command = %00000010
r_value = %00000000
So bearing in mind the data byte is 8 bits... it appears that this digipot also uses 2 bits from the command byte - that's 10 bits....so how come 257 steps?
What gives?!!
And also the fact that it uses 8 bits in a data (wiper value) byte...but also 2 bits from the command byte (least signifcant bits) ....that's got my head spinning how I approach controlling the pot in practise? (ie with the wiper control bits breaching byte boundaries) What's the std here?!!
One puzzlement disappears (how to get SPI working), but another one surfaces ........... I bought a 257 position pot (an MCP44251 - http://ww1.microchip.com/downloads/en/DeviceDoc/22060b.pdf ) *But* check this out.
If I send this...
command = %00000000 (ie a write command)
r_value = %111111111 (ie 'a wiper value of 255' or just 2 away from the 257 step maximu value) I see this...
http://img409.imageshack.us/img409/9480/36257420.jpg (http://img409.imageshack.us/i/36257420.jpg/)
(green trace is the input to the pot, yellow trace is the wiper out)
In other words, the signal is nowhere near maximum?
If I send it this...
command = %00000001
r_value = %10000000
It gets a little bigger...
http://img175.imageshack.us/img175/5715/81977059.jpg (http://img175.imageshack.us/i/81977059.jpg/)
I *can* actually get the wiper output signal to maximum (ie output = to the input signal) by sending this to the pot...
command = %00000010
r_value = %00000000
So bearing in mind the data byte is 8 bits... it appears that this digipot also uses 2 bits from the command byte - that's 10 bits....so how come 257 steps?
What gives?!!
And also the fact that it uses 8 bits in a data (wiper value) byte...but also 2 bits from the command byte (least signifcant bits) ....that's got my head spinning how I approach controlling the pot in practise? (ie with the wiper control bits breaching byte boundaries) What's the std here?!!