Instructions

231 C-Control Pro IDE
© 2013 Conrad Electronic
Sub ADC_ReadInt() As Word
Description
This function is used to read the measurement value after a successful ADC-Interrupt. The ADC-Interrupt
gets triggered after the AD conversion is completed and a new measurement value is available. See
ADC_SetInt and ADC_StartInt. The function ADC_Read delivers the digitized measured value from one of
the 8 ADC ports. The port number (0..7) has been given as a parameter in the call of ADC_Set(). The result
is in the range from 0 to 1023 according to the 10bit resolution of the A/D-Converter. The analog inputs
ADC0 to ADC7 can be measured against ground, or differentiation measurement with gain factor of
1/10/100 can be made.
Return Parameter
measured value of ADC-Port
5.4.1.4 ADC_Set
ADC Functions
Syntax
word ADC_Set(byte v_ref, byte channel);
Sub ADC_Set(v_ref As Byte, channel As Byte) As Word
Description
The function ADC_Set initializes the Analog-Digital converter. The reference voltage and the measurement
channel number is selected and the A/D converter is prepared for usage. After the measurement the value
is read with ADC_Read().
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.