| công cụ tìm kiếm bảng dữ liệu linh kiện điện tử |
|
STC89LE53RC bảng dữ liệu(PDF) 96 Page - STCmicro Technology Co,.Ltd |
|
|
|||||||||||||||||||||||||||||
STC89LE53RC bảng dữ liệu(HTML) 96 Page - STCmicro Technology Co,.Ltd |
|
96 / 165 page ![]() Example: write a program using Timer 1 to create a 500Hz square wave on P1.0. Assembly Language Solution: ORG 0030H MOV TMOD, #10H ;16-bit timer mode MOV TH1, #0F8H ;-1000 (high byte) MOV TH1, #30H ;-1000 (low byte) SETB TR1 ;Start Tmier 1 LOOP: JNB TF1, LOOP ;Wait for overflow CLR TF1 ;Clear Timer overflow flag CPL P1.0 ;Toggle port bit SJMP LOOP ;Repeat END C Language Solution : #include <REG51.H> /* SFR declarations */ sbit portbit = P1^0; /* Use variable portbit to refer to P1.0 */ main( ) { TMOD = 0x10; /* timer 1, mode 1, 16-bit timer mode */ while (1) /* repeat forever */ { TH1 = 0xF8; /* -1000 (high byte) */ TL1 = 0x30; /* -1000 (low byte) */ TR1 = 1; /* Start timer 1 */ while (TF0 !=1); /* wait for overflow */ TR1 = 0; /* stop timer 1 */ TF0 = 0; /* clear timer overflow flag */ portbit = !(portbit); /* toggle P1.0 */ } } Mode 2 Mode 2 configures the timer register as an 8-bit counter(TL1) with automatic reload. Overflow from TL1 not only set TFx, but also reload TL1 with the content of TH1, which is preset by software. The reload leaves TH1 unchanged. Interrupt SYSclk TF1 control C/T=0 C/T=1 T1 Pin TR1 GATE INT1 MCU in 12T mode MCU in 6T mode TL1 (8 Bits) TH1 (8 Bits) Timer/Counter 1 Mode 2: 8-Bit Auto-Reload ÷12 ÷6 96 |
|
Link URL |
| Cho đến nay ALLDATASHEET có giúp ích cho doanh nghiệp của bạn hay không? [ DONATE ] |
Alldatasheet là | Quảng cáo | Liên lạc với chúng tôi | Chính sách bảo mật | Liên kết đến bảng dữ liệu | Trao đổi link | Tìm kiếm theo nhà sản xuất 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 |