READADC10 channel,wordvariable

Channel - is a variable/constant specifying the ADC channel (not pin number)

Wordvariable - receives the data word read.


Read the ADC channel (10 bit resolution) contents into wordvariable.

On X2 parts you must use the ADC channel, not the pin number, in the readadc10 command (e.g. readadc10 0,w1 NOT readadc10 A.0, w1). The readadc10 command is used to read the analogue value from microcontrollers with 10-bit capability. Note that not all inputs have internal ADC functionality - check the pinout for the PICAXE chip you are using. As the result is 10 bit a word variable must be used - for a byte value use the readadc command instead.

Note for users of old AXE026 Serial Cable (does not apply to AXE027 USB Cable)

When using the debug command to output 10 bit numbers, the electrical connection to the computer via the old AXE026 serial download cable may slightly affect the ADC values. In this case it is recommended that the 'enhanced' interface circuit is used on a serial connection. The Schottky diode within this circuit reduces this issue.

Applies To:
All (except 08, 18, 18A, 28, 28A, 28X, 40X)
See Also:
Related Create:

Read an analogue value

Read a 10-bit analogue value on analogue channel 1 and report its value

Code Example:
main:	readadc10 1,w1		; read value into w1
	debug			; transmit to computer
	pause 200		; short delay
	goto main		; loop back to start
Copy Code Submit an Example

Submit Your Own Code!

You must be logged in to submit code examples. Login now.