Read voltage from an analogue (ADC) pin to a variable.


A2D PinNumber , ResultVariable


A2D 1 , W0

The analogue result can be in the range 0 to 1023, so a word variable (W0..W6) should normally used to store the result.

' Reading Analogue Devices
' Potentiometer.txt
' Kic8 

  ' Our example assumes your device is conncted to ADC1
  SYMBOL MyDevice = 1


  ' Read Analogue into Variable W0
  ' at the end of the reading, the variable W0 
  ' will have a value in the range 0..1024 (decimal)

  A2D MyDevice , W0


Simulator Feature

A Virtual Potentiometer is created for A2D Commands:


Related Circuits:

Related Components:

Electrical References: