STC15W408AS library 0.18.0
Loading...
Searching...
No Matches
Macros
Comparator

Macros

#define comparator_init_async()
 Comparator init for using interrupts routine.
 
#define comparator_start()   (bit_set(CMPCR1, CMP_ENABLE_BIT))
 Comparator start routine.
 
#define comparator_stop()   (bit_clr(CMPCR1, CMP_ENABLE_BIT))
 Comparator stop routine.
 

Detailed Description

Functions and data structures related to comparator

Comparator is used for analog compare of positive and negative inputs.

Comparator could work in async (using interrupts) or sync modes.

Author
Michael Golovanov

Macro Definition Documentation

◆ comparator_init_async

#define comparator_init_async ( )
Value:
do { \
\
enable_mcu_interrupts(); \
enable_comparator_interrupt(ANY_EDGE); \
} while(0)
#define CMPCR2_DEFAULT_VALUE
CMPCR2 register value after reset.
Definition comparator.h:35
#define CMPCR1_DEFAULT_VALUE
CMPCR1 register value after reset.
Definition comparator.h:33
@ ANY_EDGE
Any edge trigger.
Definition interrupt.h:294

Comparator init for using interrupts routine.

◆ comparator_start

#define comparator_start ( )    (bit_set(CMPCR1, CMP_ENABLE_BIT))

Comparator start routine.

Before call this method comparator should be initialized by comparator_init_async() or comparator_init_sync()

◆ comparator_stop

#define comparator_stop ( )    (bit_clr(CMPCR1, CMP_ENABLE_BIT))

Comparator stop routine.

Before call this method comparator should be started by calling comparator_start()