Download User`s Manual 08.97 8-Bit CMOS Microcontroller http://www.siemens
Transcript
On-Chip Peripheral Components
C517A
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 on port 5 are used as shown in figure 6-20.
Port Circuit
Read Latch
COMSET
VCC
16 Bit
Comparator
16 Bit
TH2
Compare
Signal
SETMSK
Bits
Internal
Bus
Write to
Latch
TL2
Timer 2
16 Bit
Comparator
16 Bit
Compare
Signal
S
D
Q
Port
Latch
CLK
Q
R
Port
Pin
CLRMSK
Bits
COMCLR
Read Pin
MCS02663
Figure 6-20
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 in 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-40
1997-08-01