AD
 
Syntax

extern int AD(int channel);
Description

 

ARMmite, ARMexpress LITE and ARMweb

AD will return 0..65472  that corresponds to the voltage on the pin corresponding to expression . The value returned will have the top 10 bits being significant.  (bits 5..0 will be 0). 0 would be read for 0V and 65472 for 3.3V.

An analog conversion on pin expression  is performed.  This process takes less than 6 usec.

Dual Use AD pins

ARMmite version

On reset or power up the AD pins are configured as AD inputs.  To change those to digital IOs, the user must individually specify a switch to digital using DIGITAL(IOpin) which is a #define for IOpins 16-23.


ARMexpress LITE version

The ARMexpress LITE supports up to 6 channels of AD converters. 

On the ARMexpress LITE and ARMweb these pins are configured as digital IOs at reset, but must be switched to AD using configAD(channel) which is a #define for channels 0-7. 

 AD(0)  IO( 7 )
 AD(1)  IO( 10 )
 AD(2)  IO( 8 )
 AD(3)            not available
 AD(4)  not available
 AD(5)  IO( 9 ) 
 AD(6)  IO( 11 )
 AD(7)

 IO( 12 )

Example

        temperature = AD(0) >> 6;             // read a raw temperature voltage

See also