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

Macros

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

Detailed Description

Functions and data structures related to comparator

Comparator is used for analog comparation 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 { \
CMPCR1 = 0x00; \
CMPCR2 = 0x09; \
\
enable_mcu_interrupts(); \
enable_comparator_interrupt(ANY_EDGE); \
} while(0)
@ ANY_EDGE
Any edge trigger.
Definition interrupt.h:296

Comparator init for using interrupts routine.

◆ comparator_start

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

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, CBIT7))

Comparator stop routine.

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