Hi Toni,
It's a lot easier than it might look. You can zero the wiper on start up. Then keep track of the high-to-low transitions on the INC pin to know the wiper position.
The wiper has a typical resistance of 400 and MAX of 1K when it's at the low-end.
I.E. even at the lowest pot setting you can still have from 400-1K ohms resistance.
If you start at ZERO and use this as a reference point (zero the wiper on power-up), then you can keep track of the pot resistance by keeping track of your transitions on the INC pin.
Example;
Zero: ' This sets the wiper to ~500 ohms (on mine)
LOW CS ' Enable wiper movement
LOW UD ' Move wiper to L position
FOR X = 0 TO 99 ' Move 100 positions
HIGH INC
LOW INC
NEXT X
HIGH CS ' Disable DS1804
RETURN
Now you know where you're starting at. Each high-to-low transition on INC will move the wiper "1" position. Assuming you had the DS1804-010 which can go to around 10K MAX, you can move the wiper from the low-end to high-end (or vice-versa) in increments of 100 ohms per transition from high-to-low on INC.
With 0 to 99 (100 total tap points) you can figure around 100 ohms per transition on INC with the 10K pot.
Increase:
LOW CS ' Enable wiper movement
HIGH UD ' Move wiper towards H terminal
FOR X = 1 TO 50 ' Move wiper to ~5.5K position
HIGH INC
LOW INC
NEXT X
HIGH CS ' Disable wiper movement
RETURN
Place your ohm-meter on the L & W pins and play with this. You'll see what I mean.
The Increase routine moved the wiper from the zero position to roughly 5.5K.
50 x 100 ohms per transition = 5K. Now I add the 500 ohms mine has when the wiper is in the zero position, and I end up with roughly 5.5K.
Now decrease it from 5.5K to 4.5K by moving it the other way 10 x 100 or 1K.
Decrease:
LOW CS ' Enable wiper movement
LOW UD ' Move wiper toward L terminal
FOR X = 1 to 10 ' 5.5K - 1K = 4.5K
HIGH INC
LOW INC
NEXT X
HIGH CS ' Disable wiper movement
RETURN
I don't use them like this, but it's definitely do-able. I only use them for digitally controlling LCD contrast. Don't much care what the actual resistance is.




Bookmarks