SHIFTOUT decimal value output data?
PBasicBeginner
Posts: 3
Hi,
I'm just curious if its possible to SHIFTOUT a decimal value i.e "6.5" on the STAMP?
I've built a D/A converter using the MAX518 chip, each time a push button has been pushed, the output to the MAX518 must increase by 2.5, and I'm using SHIFTOUT to communicate with the chip.
The maxoutput to the chip is a 255 and the minimum is 100. I'm really lost as how you would do this as the STAMP doesn't use integer math.
Any help would be greatly appreciated, thanks!
I'm just curious if its possible to SHIFTOUT a decimal value i.e "6.5" on the STAMP?
I've built a D/A converter using the MAX518 chip, each time a push button has been pushed, the output to the MAX518 must increase by 2.5, and I'm using SHIFTOUT to communicate with the chip.
The maxoutput to the chip is a 255 and the minimum is 100. I'm really lost as how you would do this as the STAMP doesn't use integer math.
Any help would be greatly appreciated, thanks!
Comments
2.5 what?
You have an 8 bit DAC, that means there are 256 steps, your last step
is your reference / 256 and every step thereafter. If you need a step of 2.5,
then your reference is 2.5 * 256 = 640
Or, I'm off by a step, but you get the general idea?
No worries, some greater intelligence than mine will be along shortly to
contradict me and the universe will come right.
The datasheet has applications, I looked.
PE -- It says [your datasheet states] your REFs are internally connected to V_DD, so your steps are 5V / 256 = 0.0195V per step:
"The MAX518 has both DAC’s reference inputs
connected to VDD. Figure 15 shows a simplified diagram
of one DAC."
Like you said, the MAX518 uses a 8 bit unsigned value ranging from 0 to 255.
This is how I would normally send a value to the chip,
255 being the value I'm sending to the chip resulting in an output of 5V, that works all fine and great.
However, how could I send a value of a decimal number, i.e "2.5" not volts, but in regards to the range that the MAX518 uses. i.e I'd like to do this.
This would result in a output of .05 volts. However, since the Stamp uses only integer math I'm a little lost as you could do this?
Would the */ operator work perhaps? All I really need is just a point in the right direction, if the */ operator will work for this, then I will figure it out myself, I know a lot of people don't like to spoon feed so I'll try my best.
(Sorry if this is still as un-articulated as my first post)
Ah right, didn't think it was possible. Thank you very much for the help!