mg84fl54 Megawin Technology, mg84fl54 Datasheet - Page 33

no-image

mg84fl54

Manufacturer Part Number
mg84fl54
Description
Full-speed Usb Micro-controller
Manufacturer
Megawin Technology
Datasheet
11.1.4. Mode 3: Timer 0 as Two 8-bit Counter
Timer 1 in Mode 3 simply holds its count. The effect is the same as setting TR1=0.
Timer 0 in Mode 3 establishes TL0 and TH0 as two separate counters. The logic for Mode 3 on Timer 0 is
shown in Fig 11-4. TL0 uses the Timer 0 control bits: C/-T, GATE, TR0, /INT0, and TF0. TH0 is locked into a
timer function (counting machine cycles) and takes over the use of TR1 and TF1 from Timer 1. Thus TH0 now
controls the Timer 1 interrupt.
Mode 3 is provided for applications requiring an extra 8-bit timer or counter. When Timer 0 is in Mode 3, Timer 1
can be turned on and off by switching it out of and into its own Mode 3, or can still be used by the serial port as
a baud rate generator, or in any application not requiring an interrupt.
Fig 11-4 Mode 3: Timer 0 as Two 8-bit Counter
11.1.5. Programmable Clock Output from Timer 0
The user can get a 50% duty-cycle clock output on P3.4 by configuring Timer 0 as 8-bit auto-reload and setting
T0CKOE to “1”. Of course, the bit TR0 (TCON.4) must also be set to start the timer. For a 12MHz system clock,
Timer 0 has a programmable output frequency range of 1953Hz to 6MHz.
The clock frequency is equal to the following equation:
11.1.6. Timer 0/1 Register
TMOD (Address=89H, Timer/Counter Mode Control Register)
GATE: Gating control.
Timer/Counter 0 or 1 is enabled only while /INT0 or /INT1 pin is high and TR0 or TR1 control pin is set. When
cleared, Timer 0 or 1 is enabled whenever TR0 or TR1 control bit is set.
MEGAWIN
Clock-out Frequency =
SYSCLK
SYSCLK
GATE
7
SYSCLK
SYSCLK
12
12
C/-T
/INT0 Pin
6
T0 Pin
GATE
TR0
TR1
Timer 1
AUXR2.T0X12=0
AUXR2.T0X12=1
AUXR2.T0X12=0
AUXR2.T0X12=1
M1
5
SYSCLK Frequency
n x (256 – TH0)
C//T=0
C//T=1
M0
4
MG84FL54B Data sheet
GATE
3
TH0[7:0]
TL0[7:0]
; n=24, if T0X12=0
; n=2, if T0X12=1
C/-T
2
Timer 0
Overflow
Overflow
M1
1
TF0
TF1
M0
0
Interrupt
Interrupt
33

Related parts for mg84fl54