My project today was to make a working setup of DS2890 digital potentiometer ,with Picaxe.
Goals:
-To learn using ow-commands. (I am quite new with Picaxe, and manual is not much help with those commands...)
-I have seen quite many questions about a SIMPLE dac in the forum...
DS2890 can accept separate Vcc on the potentiometer side, at maximum 11V.
It makes it possible to make a simple 0-10V dac with resolution of 10/256= 0,04V (in theory anyway)
Testing:
DS2890 connected to inputpin C7 on Picaxe 28X1, chips Vcc from Picaxe (5V), external Vcc (10V) to resistor side from a separate regulator.
NOTE! If using a Picaxe project board, puldown resistors must be removed! And 4k7 pull-up added to the data line.
Here is a pic of DS2890 (soic) ,and a little adapter board I had made for prototyping soic's
Here's the commented code:
(NOTE, the DS2890 is alone in that pin, so 1-wire addressing is skipped in the code)
Works nicely, but today I could not get a full 0-10V range output.
(applying ground and 10V to the RL and RH does not give out full 10V to the wiper, in theory it should...)
Have to look into it more.
Goals:
-To learn using ow-commands. (I am quite new with Picaxe, and manual is not much help with those commands...)
-I have seen quite many questions about a SIMPLE dac in the forum...
DS2890 can accept separate Vcc on the potentiometer side, at maximum 11V.
It makes it possible to make a simple 0-10V dac with resolution of 10/256= 0,04V (in theory anyway)
Testing:
DS2890 connected to inputpin C7 on Picaxe 28X1, chips Vcc from Picaxe (5V), external Vcc (10V) to resistor side from a separate regulator.
NOTE! If using a Picaxe project board, puldown resistors must be removed! And 4k7 pull-up added to the data line.
Here is a pic of DS2890 (soic) ,and a little adapter board I had made for prototyping soic's
Here's the commented code:
(NOTE, the DS2890 is alone in that pin, so 1-wire addressing is skipped in the code)
Code:
'DS2890 digital potentiometer test program by KTarke
'first inits the chip, then sets value to zero, then raises the resistor value from 0 to maximum
#picaxe 28X1
pause 500
main:
gosub Init
gosub SetWiperZero
for b1 = 0 to 255
gosub IncrementWiper 'increment wiper position by 1 step
serout 7,N2400,(254,1)
serout 7,N2400,(#b1)
pause 250
next b1
end
Init:
owout 7,%0001,($CC,$55,%01001100) 'send reset,skip rom -cmd,write control register -cmd,value
'charge pump MUST BE ON,wiper 1 selected
owin 7,%0000,(b4) 'read back sent value (read needed for right timing)
owout 7,%0000,($96) 'send release code to update -cmd
owin 7,%0000,(b4) 'read, if update was successful (if 0 then ok,test if problems w/ program)
'(read needed for right timing)
return
SetWiperZero:
owout 7,%0001,($CC,$0F,0) 'send reset,skip rom -cmd,write position -cmd,value = 0
owin 7,%0000,(b4) 'read back send value (read needed for right timing)
owout 7,%0000,($96) 'send release code to update -cmd
owin 7,%0000,(b4) 'read, if update was successful (if 0 then ok,test if problems W/ program)
'(read needed for right timing)
return
IncrementWiper:
owout 7,%0001,($CC,$C3) 'send reset,skip rom -cmd,increment wiper -cmd
owin 7,%0000,(b4) 'read back send value (read needed for right timing)
return
'To write a wanted value to wiper:
'owout 7,%0001,($CC,$0F,value)
'owin 7,%0000,(b4)
(applying ground and 10V to the RL and RH does not give out full 10V to the wiper, in theory it should...)
Have to look into it more.
Last edited: