| 数据搜索系统,热门电子元器件搜索 |
|
STC89LE52RC 数据表(PDF) 102 Page - STCmicro Technology Co,.Ltd |
|
|
|||||||||||||||||||||||||||||
STC89LE52RC 数据表(HTML) 102 Page - STCmicro Technology Co,.Ltd |
|
102 / 165 page ![]() The following figure shows DCEN=1, which enables Timer 2 to count up or down. This mode allows pin T2EX to control the counting direction. When a logic 1 is applied at pin T2EX, Timer 2 will count up. Timer 2 will overflow at 0FFFFH and set the TF2 flag, which can then generate an interrupt if the interrupt is enabled. This overflow also causes the 16-bit value in RCAP2L and RCAP2H to be reloaded into the timer registers TL2 and TH2. A logic 0 applied to pin T2EX causes Timer 2 to count down. The timer will underflow when TL2 and TH2 become equal to the value stored in RCAP2L and RCAP2H. This underflow sets the TF2 flag and causes 0FFFFH to be reloaded into the timer registers TL2 and TH2. The external flag EXF2 toggles when Timer 2 underflows or overflows. This EXF2 bit can be used as a 17th bit of resolution if needed. The EXF2 flag does not generate an interrupt in this mode. Timer 2 Interrupt SYSclk TF2 control C/T2=0 C/T2=1 T2 Pin T2EX Pin MCU in 12T mode MCU in 6T mode TL2 (8 Bits) RCAP2L Timer 2 in Auto-Reload Mode (DCEN=1) ÷12 ÷6 TR2 TH2 (8 Bits) RCAP2H EXF2 FFH FFH Toggle Count Direction 1=UP 0=DOWN Overflow Down Counting Reload Value Up Counting Reload Value Buad-Rate Generator Mode Timer2 can be configured to generate various baud-rate. Bit TCLK and/or RCLK in T2CON allow the serial port transmit and receive baud rates to be derived from either Timer1 or Timer2. When TCLK=0, Timer1 is used as the serial port transmit baud rate generator. When TCLK=1, Timer2 is used as the serial port transmit baud rate generator. RCLK has the same effect for the serial port baud rate. With these two bits, the serial port can have dif- ferent receive and transmit baud rates – one generated from Timer 1 and the other from Timer 2. In BRG mode, Timers is operated very like auto-reload up-only mode except that the T2EX pin cannot control re- load. An overflow on Timer 2 will load RCAP2H, RCAP2L contents onto Timer2, but TF2 will not be set. A 1-to-0 transition on P2EX pin can set EXF2 to request interrupt service if EXEN2=1. The following figure shows the Timer 2 in baud rate generation mode to generate RX Clock and TX Clock into UART engine. 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 software. The baud rate in UART Mode 1 and Mode 3 are determined by Timer2’s overflow rate given below: Baud Rate= Timer 2 overflow rate 16 (counting T2EX) The Timer can be configured for either "timer" or "counter" operation. In the most typical applications, it is configured for "timer" operation(C/T2=0)."Timer" operation is a little different for Timer 2 when it's being used as a baud rate generator. Normally, as timer it would increment every machine clcye(thus at 1/6 or 1/12 the system clock).In that case the baud rate is given bu the formalu: Baud Rate= SYSclk n×[65536 - (RCAP2H, RCAP2L)] (as timer) when MCU in 12T mode, n=32; When MCU in 6T mode, n=16. 102 |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |