reading voltage input to 08M2 and display on OLED

nevcams

New Member
Hi all,
I'm yet another novis to the world of electronics, I was wondering if there is any way I could read the voltage on my project board and display it on my OLED. Ive tried readadc, then tried to alter values but it,s doing my head in.
 

nick12ab

Senior Member
Hi all,
I'm yet another novis to the world of electronics, I was wondering if there is any way I could read the voltage on my project board and display it on my OLED. Ive tried readadc, then tried to alter values but it,s doing my head in.
Welcome to the forum. It would help if you could post your attempted code for it to be nitpicked corrected.

However, a common mistake to check for is failure to convert a variable into ASCII characters for display on the OLED, in which case your existing code might use serout C.0,N2400,(254,128,"Voltage = ",b0). If this is the case then read on.

There are two ways of doing ASCII conversion - the easiest is simply to precede the variable with a # and to put two spaces afterwards: serout C.0,N2400,(254,128,"Voltage = ",#b0). This method does not produce leading zeroes.

The second way is to use the bintoascii command and this way uses more variables but is ideal if you want leading zeroes or want to insert a decimal point. Example:
bintoascii b0,b1,b2,b3
serout C.0,N2400,(254,128,"Voltage = ",b1,b2,b3)

Example with decimal point:
bintoascii b0,b1,b2,b3
serout C.0,N2400,(254,128,"Voltage = ",b1,b2,".",b3)


P.S. When posting more than a couple of lines use [CODE][/CODE] tags.
 

BeanieBots

Moderator
Another issue is that the PICAXE measures voltages relative to its power supply voltage. If you want to measure its own supply, you will need to provide an independant reference or (only available on some variants) configure it to use an internal reference.
 
Top