PDA

View Full Version : Help in Understanding the Math



Ramius
- 24th March 2012, 08:31
It has been a long time since I have done any programming and somehow I have completely forgotten the logic / rules for doing simple math functions. I have a drawer full of LTC1298 A to D converters which produce a 12 bit number. At say 5 vdc on the input to the 1298 you will get 4096 as the digital representation. 4096 divided by 5.0 volts would say you have .0012207 volts per bit. Okay so now you have 12207 times the reading from the LTC1298. At 2.5 volts this would be half of the 4098 or 2048. 2048 time 12207 would give 24,999,936 which is far in excess of the 65,535 limit of the PIC. So, what is the logic in doing the math?

Thanks, Ed

mister_e
- 24th March 2012, 08:56
V/5 = adc/4096

v = (adc/4096) * 5

adc = (v * 4096) / 5

Ramius
- 24th March 2012, 15:49
Thank you Steve!
Now I feel like the guy in your avatar!

Best, Ed