28X2 ADC setup help needed

I don't think I understand the adcsetup command for the 28X2, where it is apparently mandatory. I put a varying voltage on ADC13 (pin 26) and run the following:

let adcsetup=13
symbol Press=w0

main:
pause 1000
readadc10 13,w0
sertxd("Volts=",press,cr)
goto main

It works very well until I get up to about 1 volt, then goes haywire, which the manual did say would happen if setup is not right. Any good examples of using setup on this part?

Also: I get the following output on the terminal screen

volts={E8}

where the volt value is in hex. Not a big deal, but aggravating to convert each value.

Thanks Bayside888
 

hex

Active member
change press to #press to output a value, rather than a single character

Code:
' random code from forum

let adcsetup = 13
symbol press = w0

main:
    pause 1000
    readadc10 13,w0
    sertxd("Volts=",#press,cr)
    goto main
 

inglewoodpete

Senior Member
I don't think I understand the adcsetup command for the 28X2, where it is apparently mandatory. I put a varying voltage on ADC13 (pin 26) and run the following:

let adcsetup=13
symbol Press=w0

main:
pause 1000
readadc10 13,w0
sertxd("Volts=",press,cr)
goto main

It works very well until I get up to about 1 volt, then goes haywire, which the manual did say would happen if setup is not right. Any good examples of using setup on this part?

Thanks Bayside888
Reading between the lines, since you want to use ADC13, so you want to set BIT 13 of the ADCSetup (system) word variable. Refer to the example provided in Manual 2 (Command Manual) at the bottom of Page 33. The channel is automatically set to analogue when you use the ReadADC or ReadADC10 commands. Its only practical use is to turn a pin back from ADC input to digital input.

In your case, if you want to use the command (not essential in your case) use it as let adcsetup=%0010000000000000.
 
Last edited:
Thanks hex and inglewoodPete: program works fine now. Interestingly, the ADC on this part seems at least as accurate as my Fluke voltmeter.
 
Top