Ghost13. Do you have a what is a microcontroller book? This site has the information you need with detailed circuit diagrams. Go to the download area as well as the nuts and volts free online materials, I am sure they have one on that.
The answer is yes but not directly because a pin can only be a 1 or a 0, you use an RC circuit. Basically charge a tiny capacitor that holds the pin high (reads as a 1) then discharge it and see how long it takes to discharge. When it is discharged below a certain voltage the pin then reads zero that is when the timer is checked to see how long it took. Reading very low voltages take additional circuits to amplify, read and then calculate.
Also search the forums, many discussions on RC circuits as well as how to use external chips that read voltage like ADC chips.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
ghost13,
Tracey Allen a regular on here has an example on how to read voltage with RC time on a BS2 I am sure you can adopt it. http://www.emesystems.com/BS2rct.htm look for battery voltage monitor...
Comments
The answer is yes but not directly because a pin can only be a 1 or a 0, you use an RC circuit. Basically charge a tiny capacitor that holds the pin high (reads as a 1) then discharge it and see how long it takes to discharge. When it is discharged below a certain voltage the pin then reads zero that is when the timer is checked to see how long it took. Reading very low voltages take additional circuits to amplify, read and then calculate.
Also search the forums, many discussions on RC circuits as well as how to use external chips that read voltage like ADC chips.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
Tracey Allen a regular on here has an example on how to read voltage with RC time on a BS2 I am sure you can adopt it. http://www.emesystems.com/BS2rct.htm look for battery voltage monitor...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen