Instructions

232Libraries
© 2013 Conrad Electronic
5.4.1.5
ADC_SetInt
ADC Functions
Syntax
word ADC_SetInt(byte v_ref, byte channel);
Sub ADC_SetInt(v_ref As Byte, channel As Byte) As Word
Description
The function ADC_SetInt initializes the Analog-Digital converter for interrupt usage. The reference voltage
and the measurement channel number is selected and the A/D converter is prepared for the measure-
ment. An interrupt service routine must be defined. After successful interrupt the value can be read with
ADC_ReadInt().
The result of an A/D conversion can be influenced, if any Port Bit (configured for output) on the same
Port as the A/D channel, is changed during the measurement.
Parameter
channel port number (0..7)of ADC (Port A.0 to A.7 at Mega32, Port F.0 to F.7 at Mega128)
v_ref reference voltage (see table)
Name
Value (Hex)
Description
ADC_VREF_BG
C0
2,56V internal reference voltage
ADC_VREF_VCC
40
supply voltage (5V)
ADC_VREF_EXT
00
external reference voltage on PAD3
For the location of PAD3 see Jumper Application Board M32 or M128.
5.4.1.6 ADC_StartInt
ADC Functions
Syntax
void ADC_StartInt(void);
Sub ADC_StartInt()
Description
The measurement is started if the A/D converter has previously been initialized to interrupt service with a
call to ADC_SetInt(). After the measurement is ready, the interrupt gets triggered.
Parameter
None