|
|
Component
FreescaleAnalogComp
Analog comparator on Freescale derivates
Component Level: Low
Category:
CPU Internal Peripherals-Measurement
Typical Usage:
(Examples of a typical usage of the component in user code.
For more information please
see the page Component Code
Typical Usage.)
Assume the component name "Cmp1".
(1)
MAIN.C
void main(void)
{
byte CmpOutputVal
byte res;
...
res=Cmp1_GetAnalogComparatorOutputValue(&CmpOutputVal);
...
}
(2)
EVENTS.C
void Cmp1_OnCompare(void)
{
byte CmpOutputVal
byte res;
...
/* "Analog comp. mode" property is set to 'falling and rising edge' */
/* Get comp. output value */
res=Cmp1_GetAnalogComparatorOutputValue(&CmpOutputVal);
...
if(CmpOutputVal)
... /* Actual output compare value is 1 */
else
... /* Actual output compare value is 0 */
}
|