As a newbie to PICAXE I have located a programme posted to this forum that I would like to use but it does not work.
Posted on 07/09/2005 under the heading 'ADC Voltage display ?'
Here is the programme:
symbol reading = w0
symbol gain = 192
symbol zero = 10
loop:
readadc 0, reading
reading = reading * gain / 100 + zero
sertxd ("Voltage is ",reading/100,".",reading%100,"", 13)
goto loop
Firstly I changed the routine 'loop' to 'loop1' as 'loop' produces the syntax error 'Loop without DO'.
This fixes that syntax error and the programme then is:
symbol reading = w0
symbol gain = 192
symbol zero = 10
loop1:
readadc 0, reading
reading = reading * gain / 100 + zero
sertxd ("Voltage is ",reading/100,".",reading%100,"", 13)
goto loop1
I am getting a syntax error with the sertxd line.
My limited knowledge of PICAXE shows that there should be a '#' in front of 'reading/100' and 'reading%100 so my modified sertxd line now reads:
sertxd ("Voltage is ",#reading/100,".",#reading%100, 13)
I am still getting syntax errors and I don't know why.
I am using an 18X device with a 10k pot connected between GND and +5 with the wiper connected to chips adc 0 input but until I can get rid of the syntax errors I am unable to test it.
Would appreciate some assistance with this sertxd line so I can get the programe to work.
Eddydde
Posted on 07/09/2005 under the heading 'ADC Voltage display ?'
Here is the programme:
symbol reading = w0
symbol gain = 192
symbol zero = 10
loop:
readadc 0, reading
reading = reading * gain / 100 + zero
sertxd ("Voltage is ",reading/100,".",reading%100,"", 13)
goto loop
Firstly I changed the routine 'loop' to 'loop1' as 'loop' produces the syntax error 'Loop without DO'.
This fixes that syntax error and the programme then is:
symbol reading = w0
symbol gain = 192
symbol zero = 10
loop1:
readadc 0, reading
reading = reading * gain / 100 + zero
sertxd ("Voltage is ",reading/100,".",reading%100,"", 13)
goto loop1
I am getting a syntax error with the sertxd line.
My limited knowledge of PICAXE shows that there should be a '#' in front of 'reading/100' and 'reading%100 so my modified sertxd line now reads:
sertxd ("Voltage is ",#reading/100,".",#reading%100, 13)
I am still getting syntax errors and I don't know why.
I am using an 18X device with a 10k pot connected between GND and +5 with the wiper connected to chips adc 0 input but until I can get rid of the syntax errors I am unable to test it.
Would appreciate some assistance with this sertxd line so I can get the programe to work.
Eddydde