I have used these successfully with the basic stamp before.. but am having some trouble with the math to send the values to the POTS of it....
has anyone used one of these? it requires 17 bits of data... the first bit I just pulse out and that handles that... same way I did it on the basic stamp..
the next 16 are where im having issues.. if i want to set both pots at say value 100.. somehow i have to get the value 100 sent "twice" in a 16 bit value and thats where im getting lost here...
here is the code im trying to use (with some debugging in it to watch what I see)
in the basic stamp I would just put my desired value 0-255 into the high byte and the low byte of a "word" variable...
how do I do that in zbasic?
so if I wanted to set both values to "100"..
so anyone who may have better understanding please help..
Code: Select all
' *************************************************************
' sub routine to set the digital POT values
' *************************************************************
public sub setpot(byval num as integer)
call putqueuestr(oq,"sending data to pot:"+cstr((num*100)+num)+chr(13)+chr(10))
' bring up the reset line to high to begin the POT set.
call putpin(c.4,zxoutputhigh)
' send a blank pulse across DQ as we dont need the stack select feature
call pulseout(c.3,1,1)
' send out the data 1 bit at a time MSB first
call shiftoutex(c.5,c.3,16,cint((num*100)+num),0)
call putpin(c.4,zxoutputlow)
end sub