English
Language : 

C509-L_97 Datasheet, PDF (126/290 Pages) Siemens Semiconductor Group – 8-Bit CMOS Microcontroller
On-Chip Peripheral Components
C509-L
6.3.3.3 Compare Mode 2
In the compare mode 2 in the CCU can be used for the concurrent compare outputs at port 5. In
this compare mode 2 the port 5 pins are no longer general purpose I/O pins or under control of
compare/capture register CC4, but under control of the compare registers COMSET and COMCLR.
These both 16-bit registers are always associated with timer 2 (same as CRC, CC1 to CC4).
In compare mode 2 the concurrent compare output pins at port 5 are used as shown in figure 6-24.:
COMSET
16 Bit
Comparator
16 Bit
TH2 TL2
Timer 2
16 Bit
Comparator
16 Bit
COMCLR
Compare
Signal
SETMSK
Bits
Compare
Signal
CLRMSK
Bits
Port Circuit
Internal
Bus
Write to
Latch
Read Latch
VCC
S
D Port Q
Port
Pin
Latch
CLK
R
Q
Read Pin
MCS02663
Figure 6-24
Compare Function of Compare Mode 2
– When a compare match occurs with register COMSET, a high level appears at the pins of port
5 when the corresponding bits in the mask register SETMSK are set.
– When a compare match occurs with register COMCLR, a low level appears at the pins of port
5 when the corresponding bits in the mask register CLRMSK are set.
– Additionally, the port 5 pins which are used for compare mode 2 can also be directly written
using write instructions to SFR P5. Further, the pins can also be read under program control.
If compare mode 2 shall be selected, register CC4 must operate in compare mode 1 (with the
corresponding output pin P1.4); Therefore, compare mode 2 is selected by enabling the compare
function for register CC4 (COCAH4=1; COCAL4=0 SFR CC4EN) and by programming bits
COCOEN0 and COCOEN1 in SFR CC4EN. Like in concurrent compare mode associated with
CC4, the number of port pins at P5 which serve the compare output function can be selected by bits
COCON0-COCON2 (in SFR CC4EN). If a set and reset request occurs at the same time (identical
values in COMSET and COMCLR), the set operation takes precedence. It is also possible to use
only the interrupts which are generated by matches in COMSET and COMCLR without affecting
port 5 (“software compare”). For this “interrupt-only” mode it is not necessary that the compare
function at CC4 is selected.
Semiconductor Group
6-48
1997-10-01