Voltage conversion problem
scary terry
Posts: 24
in BASIC Stamp
I'm working on a simple circuit to read a voltage, run it through an ADC, process it with a BS2 and output it to a display. It works fine until I get to x.80 volts. As an example, if I input 3.79 volts, I get an output of 3.79 but if I input 3.80 volts, I get an output of 3.00. I get strange numbers anywhere between 3.80 and 3.99 then it's good once I pass 4.00 volts, again until reaching 4.80 volts. I've attached a snippet of the code I'm using, in this case just for troubleshooting. I'm guessing my problem is in the modulus calculation, it appears that a remainder of 655 or lower works fine while 656 or higher doesn't. In this example code, voltx simulates the output from the ADC, if voltx=3112 (3112/819=3 r655), my output is 3.79. If voltx=3113 (3113/819=3r656), my output is 3.00.
Any ideas what I'm doing wrong?
Any ideas what I'm doing wrong?
bs2
739B
Comments
The 8000 above is equal to 500 * 65536 / 4096.
-Phil