Help with ADC data
poorieuser
Posts: 7
Ok so I'm doing some data logging use the BS2 stamp and an 8 bit ADC. Basically I need to program to bring in the data from the ADC that tells me Potential of a battery pack in a circuit. When it reaches a certain point I need the program to stop running.
Right now the program reads in the data from the ADC fine. It gives me an 8bit binary value. I can convert that outside the program and figure out the voltage easily. However I need the program to be able to convert the 8bit binary value into a decimal value so I can use a DO UNTIL loop and have it end when the potential reaches 2 volts. Otherwise the test destroys the batteries as it runs indefinitely.
Any help will be greatly appreciated.
Right now the program reads in the data from the ADC fine. It gives me an 8bit binary value. I can convert that outside the program and figure out the voltage easily. However I need the program to be able to convert the 8bit binary value into a decimal value so I can use a DO UNTIL loop and have it end when the potential reaches 2 volts. Otherwise the test destroys the batteries as it runs indefinitely.
Any help will be greatly appreciated.
Comments
volt = binary value * 50 / 255
This will give you a reading of 0 to 50 tenths of a volt, so 2V would be 20.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
SelmaWare Solutions - StampPlot GUI for controllers, XBee and Propeller Application Boards
Southern Illinois University Carbondale, Electronic Systems Technologies
Basically the code reads a binary value in from the adc to a variable adcBits.
adcBits is a 8bit binary value originally but I need to convert it to a decimal value, at least, from what I understand.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Basically if I have, when adcBits is an 8bit binary...
DO UNTIL (adcBits * 5/256 <2)
blah blah
blah
LOOP
It should loop until my circuit dips below two volts?