Split Timer 2 Mode 4 (8-Bit Pwm Mode); Baud-Rate Generator Mode (Brg) - CMOSTEK CMT2380F17 Manual

Ultra low power sub-1ghz wireless mcu
Table of Contents

Advertisement

16.2.9 Split Timer 2 Mode 4 (8-bit PWM Mode)

In this mode, Timer 2 is an 8-bit PWM mode as shown in Figure 16–20. TH2 and RCAP2H are combined
to an 8-bit auto-reload counter. Software configures these two registers to decide the PWM cycle time. TL2 is
the PWM compare register to generate PWM waveform. RCAP2L is the PWM buffer register and software will
update PWM data in this register. Each TH2 overflow event will set TF2 and load RCAP2L value into TL2. The
PWM signal will be output on T2CKO function pin and the output is gated by T2OE in T2MOD register.
Figure 16-20. Split Timer 2 Mode 4 Structure (8-bit PWM mode)

16.2.10 Baud-Rate Generator Mode (BRG)

Bits TCLK and/or RCLK in T2CON register allow the serial port transmit and receive baud rates to be
derived from either Timer 1 or Timer 2. When TCLK=0, Timer 1 is used as the serial port transmit baud rate
generator. When TCLK= 1, Timer 2 is used as the serial port transmit baud rate generator. RCLK has the
same effect for the serial port receive baud rate. With these two bits, the serial port can have different receive
and transmit baud rates – one generated by Timer 1, the other by Timer 2.
Figure 16–21 shows the Timer 2 in baud rate generation mode to generate RX Clock and TX Clock into
UART engine (See Figure 18–6.). The baud rate generation mode is like the auto-reload mode, in that a
rollover in TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H and
RCAP2L, which are preset by firmware.
The Timer 2 as a baud rate generator mode is valid only if RCLK and/or TCLK=1 in T2CON register. Note
that a rollover in TH2 does set TF2. Thus, the Timer 2 interrupt does not have to be disabled when Timer 2 is
in the baud rate generator mode by setting TF2IG to block TF2 interrupt. Also if the EXEN2 (T2 external
enable bit) is set, a 1-to-0 transition in T2EX (Timer/counter 2 trigger input) will set EXF2 (T2 external flag) but
will not cause a reload from (RCAP2H, RCAP2L) to (TH2,TL2). Therefore when Timer 2 is in use as a baud
Rev0.1 | 149/347
CMT2380F17
www.cmostek.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the CMT2380F17 and is the answer not in the manual?

Questions and answers

Table of Contents