| 数据搜索系统,热门电子元器件搜索 |
|
STC89LE52RC 数据表(PDF) 103 Page - STCmicro Technology Co,.Ltd |
|
|
|||||||||||||||||||||||||||||
STC89LE52RC 数据表(HTML) 103 Page - STCmicro Technology Co,.Ltd |
|
103 / 165 page ![]() 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 not set TF2, and will not generate an interrupt. Thus, the Timer 2 interrupt does not have to be disabled when Timer 2 is in the baud rate generator mode. 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 rate generator, T2EX can be used as an additional external interrupt, if needed. It should be noted that when Timer 2 is running (TR2=1) in "timer" function in the baud rate generator mode, one should not try to read or write TH2 and TL2. As a baud rate generator, Timer 2 is incremented at 1/2 the system clock or asynchronously from pin T2; under these conditions, a read or write of TH2 or TL2 may not be accurate. The RCAP2 registers may be read, but should not be written to, because a write might overlap a reload and cause write and/or reload errors. The timer should be turned off (clear TR2) before accessing the Timer 2 or RCAP2 registers. Timer 2 Interrupt SYSclk ÷2 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 Baud-Rate Generator Mode ÷12 ÷6 TR2 TH2 (8 Bits) RCAP2H EXF2 Transition Detector control EXEN2 '0' '1' '1' '0' ÷16 ÷16 '1' '0' Timer 1 Overflow SMOD RCLK RX Clock TX Clock TCLK Reload The following program is an assembly language code that domestrates Timer 2 of STC89xx series MCU acted as baud rate generator. ;/*------------------------------------------------------------------------------------------------------------*/ ;/* --- STC MCU International Limited ----------------------------------------------------------------*/ ;/* --- STC 89xx Series MCU Timer 2 as Baud Rate Generoter Demo ------------------------*/ ;/* If you want to use the program or the program referenced in the */ ;/* article, please specify in which data and procedures from STC */ ;/*--------------------------------------------------------------------------------------------------------------*/ ;Declare STC89xx series MCU SFRs ;SFRs associated with Timer 2 and RS232 port T2CON EQU 0C8H TR2 EQU T2CON.2 ;TR2 is the second bit in SFR—T2CON 103 |
|
链接网址 |
| 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 |