| ??? 03/12/01 11:56 Read: times |
#9947 - Why changing th0/tl0, time not change ? |
This code is modified from the question "How can I use a timer to count 5 seconds?" in FAQ. I expect to get p1.5 blinking time change when I change th0 and tl0 but not.
Thanks for reply TCOUNT EQU 40h ;This is an address in IRAM ALARM EQU 00h ;This is an address of BIT memory TIH equ 00h TIL equ 0ffh ORG 0000h LJMP MAIN ORG 000Bh T0_INTERRUPT: CLR tr0 MOV TL0,#til ;Set TL0 to 0B0h MOV TH0,#tih ;Set TH0 to 3Ch setb tr0 jb p1.5,cc setb p1.5 sjmp ccc cc: clr p1.5 ccc: T0_EXIT: RETI ;Return from the interrupt MAIN: MOV TMOD,#01h ;Set timer 0 to 16-bit mode MOV TH0,#tih ;Initialize TH0 to overflow every .05 seconds MOV TL0,#til ;Initialize TL0 to overflow every .05 seconds SETB ET0 ;Enable timer interrupt 0 SETB EA ;Enable all interrupts MOV TCOUNT,#20 ;Set TCOUNT to 20 to wait for 1 second SETB TR0 ;Turn timer 0 on sjmp $ |
| Topic | Author | Date |
| Why changing th0/tl0, time not change ? | 01/01/70 00:00 | |
| RE: Why changing th0/tl0, time not change ? | 01/01/70 00:00 | |
| RE: Why changing th0/tl0, time not change ? | 01/01/70 00:00 | |
RE: Why changing th0/tl0, time not change ? | 01/01/70 00:00 |



