08m2

techElder

Well-known member
#2
Welcome to the forum, crazy!

You need to provide much more information than that. Remember that we are "flying blind" and know nothing about you or what you are having trouble with.

What's the purpose of your project? What is your experience level? What lcd? What project board? Did you draw a schematic? Do you have a photo of your setup?

Are you really ... crazy? ;)
 
#3
Haha no I'm not crazy... I'm using a parallax lcd. I got it to read 0-255 but how do I get it to read 5.00 volts. What formula would I use to do so. Thanks
 

hippy

Technical Support
Staff member
#4
If your 0 reading represents 0V and 255 represents 5V then to convert would mathematically be -

volts = reading * 5 / 255

But PICAXE only deals with whole numbers and maths is limited to a maximum value of 65535. You can determine how many 10mV's there are using -

volts = reading * 100 / 51 ; Equivalent to volts = reading * 500 / 255

Giving a 0 to 500 result. Split that number into hundred, tens and unit digits and then output those digits with a decimal point in the appropriate place.
 
#5
so this will give me 2.55 and i try to make it 5.00 i cant seem to get it ....i got this down any help to get 5.00 thanks

main:
readadc c.1,w1
b1=w1/100
w1=w1//100
b3=b2//10
b2=b2/10
serout c.2,t2400,("votage=",#b1,".",#b2,#b3,cr,lf,17)
goto main
 

hippy

Technical Support
Staff member
#6
This should work -

Code:
#Picaxe 08M2
#Terminal 4800
main:
  readadc c.1,b0
  b0 = b0 * 100 / 51  ; Calculate voltage 000 to 500
  b1 = b0 / 100 // 10 ; Hundreds
  b2 = b0 / 10  // 10 ; Tens
  b3 = b0 / 1   // 10 ; Units
  sertxd("votage=",#b1,".",#b2,#b3,cr,lf)
  pause 500
  goto main
That will display the voltage in the serial terminal window. Once happy with the results you can replace the SERTXD with your desired SEROUT command.
 

techElder

Well-known member
#8
That's a good result.

Now don't be a crazy stranger ... uh, I mean don't be a strange crazy ... no, don't be a stranger, crazy! ;)
 
Top