Hi all,
I am reading a 0-10VDC signal with a 16-bit ADC.
So I am taking the LONG (just in case I need the room later) variable that I am reading that 16bit number into, lets say 10 volts for %1111111111111111 (65535) and multiplying it by 15259 to get = 999998565
And then to read it out on my LCD, I'm doing the typical:
LCDOUT $FE, 1 DEC myADCvariable / 100000000, "." , DEC8 myADCvariable // 100000000
to get a nice decimal representation of the voltage = 9.99998565
The issue is that I want to only see the first 4 decimal places to the right of the decimal, as there is some noise (out of my control, reading from a board that has the 16bit ADC and I can't add filter caps to it etc.) and the last few bits flip around.
I've tried everything that I can think of, but not coming up with a solution.
If I try: LCDOUT $FE, 1 DEC myADCvariable / 100000000, "." , DEC4 myADCvariable // 1000 - then I get = 9.8565 and those last four digits are going crazy... and they are the wrong 4 digits anyway!
I need = 9.9999 (well closer to 10.0 whatever with a calibration factor, but one problem at a time.)
What do I need to be doing to only get the decimal places I need and mask the ones I don't?
Thanks!
Ryan
Bookmarks