So is multiplication by 49 good enough or is it not, in which case follow the link in my last post to find some more accurate alternatives.Just unsure where to start.
Great!I've managed to view a pot connected to an adc pin.As I rotate the pot it reads 0 to 1023.
I would like to convert the reading in to 0 to 5volts the resolution is not that important.
pause 1000
serout c.2,n2400,(254,1)
pause 500
main: readadc10 c.1, w0
w0=w0*44/9
bintoascii w0,b11,b12,b13,b14,b15
serout c.2, n2400, ( 254, $80 )
serout c.2, n2400, (" Pot")
serout c.2, n2400, ( 254, $C0 )
serout c.2, n2400, (b12,".")
serout c.2, n2400, (b13,b14,b15," volts " )
pause 500
goto main
'===================================
#Picaxe 20M2
#No_Data
Pause 100
'=====================================
FVRSETUP FVR2048 'Set Fixed Voltage Reference = 2.048 Volts
ADCCONFIG %011 'Set ADC to FVR
do
readadc10 B.6, W5
w5 = w5 * 6 / 10
bintoascii w5,b0,b0,b0,b1,b2
sertxd (b0,".",b1,b2," Volts DC",cr,lf)
pause 2000
loop
You are NOT wasting time.Hi
Thank you for all the replies.
I hope iam not wasting your time as there many new people asking for advice.
Yes, but the fvrsetup command is automatically disabled after the readadc command is used and you must reissue the fvrsetup command.If I use the fvrsetup for 2 volts ,does this mean all the adc inputs are set for 2volt.
Picaxe 08m2
I am using the setup to monitor 0-6volts,through voltage divider as Goeytex pointed out.
DS18B20 is not analogue (unlike a thermistor), it is 1-wire. You can read it using the readtemp command, which is completely unrelated to the readadc command plus does not require an ADC pin.I would like to read a ds18b20 temp sensor on another adc input.
The page for readtemp does state that all the pins that cannot be used with the readtemp command cannot be used because they are fixed inputs or outputs, not because they don't have ADC channels.I have checked the read temp command and assumed it needs an adc input.
It says this in the manual, but it doesn't seem to work that way, at least not with readadc10. With Readadc10 it seems to work fine without needing to be reset after each read. See my post HEREYes, but the fvrsetup command is automatically disabled after the readadc command is used and you must reissue the fvrsetup command.
The readtemp and readtemp12 references have been updated to make it clearer that the DS18B20 connects to a digital I/O pin and that the pin must be able to support both input and output.However Rev-Ed should add a statement that the readtemp and readadc commands are unrelated and that the readtemp command can only be used on bidirectional pins.
hippy, shouldn't the code example for readtemp12 refer to w1, rather than b1?The readtemp and readtemp12 references have been updated to make it clearer that the DS18B20 connects to a digital I/O pin and that the pin must be able to support both input and output.
Yes; it was just a comment mismatch. Now corrected.hippy, shouldn't the code example for readtemp12 refer to w1, rather than b1?
fvrsetup fvr2048
adcconfig %011
pause 3000
serout c.0,n2400,(254,1)
pause 500
main: readadc10 c.4, w0
w0=w0*32
bintoascii w0,b11,b12,b13,b14,b15
serout c.0, n2400, ( 254, 128 ) ; first line of display position 1
serout c.0, n2400, (b11,b12,".")
serout c.0, n2400, ( b13,b14," Vdc" )
pause 300
readadc10 c.1, w5
w5=w5*6
bintoascii w5,b1,b2,b3,b4,b5
serout c.0, n2400, ( 254, 192 ) ;second line of display position 1
serout c.0, n2400, (b2,".")
serout c.0, n2400, ( b3,b4," Sink Amps" )
pause 300
readtemp c.2, w8
bintoascii w8, b22,b23,b24,b25,b26
serout c.0, n2400, ( 254,138 ) ; First line of display posistion 10
serout c.0, n2400, (b24,b25,b26,223,"C" )
pause 300
goto main