129
C-Control Pro Mega Series
6.3
Analog-Comparator
The Analog Comparator allows to compare two analog signals. The result of this comparison is returned
as either "0" or "1".
6.3.1
AComp
AComp Functions
Syntax
void AComp(byte mode);
Sub AComp(mode As Byte);
Description
The Analog Comparator allows to compare two analog signals. The result of this comparison is returned
as either "0" or "1". ( Comparator Output ). The negative input is Mega32: AIN1 (PortB.3), Mega128: AIN1
(PortE.3). The positive input can either be Mega32: AIN0 (PortB.2), Mega128: AIN0 (PortE.2) , or an internal
reference voltage of 1,22V.
Parameter
mode working mode
Mode Values:
0x00
0x40
0x80
6.3.2
AComp Example
Example: Usage of Analog-Comparators
// AComp: Analog Comparator
// Mega32:
//
// Mega128: Input (+) PE2 (PortE.2) bzw. band gap reference 1,22V
//
// used Library: IntFunc_Lib.cc
// The function AComp returns the value of the comparator.
// If the voltage on input PB2/PE2 is greater than the input PB3/PE3 the
// function AComp returns the value 1.
// Mode:
// 0x00
Example
external inputs (+)AIN0 and (-)AIN1 are used
external Input (-)AIN1and internal reference voltage are used
Analog-Comparator gets disabled
Input (+) PB2 (PortB.2) bzw. band gap reference 1,22V
Input (-) PB3 (PortB.3)
Input (-) PE3 (PortE.3)
external inputs (+)AIN0 and (-)AIN1 are used
© 2008 Conrad Electronic
Need help?
Do you have a question about the C-Control Pro Mega Series and is the answer not in the manual?
Questions and answers