Comparator 1/2/3 - Samsung S3F84B8 User Manual

8-bit cmos
Hide thumbs Also See for S3F84B8:
Table of Contents

Advertisement

S3F84B8_UM_REV 1.00

14.1.1.2 Comparator 1/2/3

Comparator 1, 2, and 3 have the same structure. Their positive input is internally connected with reference
voltage, programmable from 0.45VDD to 0.8VDD with the step length of 0.05VDD.
The output (falling edge) of comparator 1, 2, and 3 can be configured to generate PWM hard lock trigger signal
(PWMCCON.1–.2/.3-0.4/.5/.6 = 11) or soft lock trigger signal (PWMCCON.1–.2/.3–0.4/.5/.6 = 01).
In case of hard lock, PWM output will stop immediately (stop voltage level is determined by PWM output polarity
bit, that is, when PWMCON.5 = 0, PWM output is '0' and when PWMCON.5 = 1, PWM output is '1'). To unlock the
hard lock, write '1' to PWMCON.3.
On the other hand, in case of soft lock, PWM output will stop immediately (stop voltage level is determined by
PWM output polarity bit, that is, when PWMCON.5 = 0, PWM output is '0' and when PWMCON.5 = 1, PWM output
is '1'). The PWM output will then reload PWMDATA with PWMPDATA. Soft lock will be automatically unlocked in
the next PWM cycle.
14.1.1.2.1 Comparator Control Register (CMP1CON, COM2CON, CMP3CON)
You can use comparator control registers for the following purposes:
Select comparator reference voltage
Enable comparator
Enable comparator interrupt
Set comparator output polarity
Check comparator status
Clear interrupt pending bit
CMP1CON, CMP2CON, and CMP3CON are located at address EBH, ECH, and EDH, Set1 Bank0, and are
read/write addressable (except CMP1/2/3CON.1) using Register addressing mode.
To enable comparator1/2/3, you must write '1' to CMP1/2/3CON.3. The positive input of comparator is internally
connected with reference voltage, programmable from 0.45VDD to 0.8VDD with step length of 0.05VDD.
The output polarity is programmable by configuring CMP1/2/3CON.4.
CMP1/2/3CON.1 represents the real status of two inputs, read as '0' when CMP1/2/3_N > reference voltage or '1'
when CMP1/2/3_N < reference voltage.
Comparator 1/2/3 can generate an interrupt to indicate the alternation of two input pins. You can choose the falling
edge, rising edge, or falling and rising edge to trigger the comparator interrupt by configuring CMPINT register. To
enable the interrupt, write '1' in CMP1/2/3CON.2. On the other hand, to clear the interrupt pending bit, write '0' to
CMP1/2/3CON.0. The interrupt pending bit must be cleared by the software.
14-4
14 COMPARATOR

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents