??? 06/02/10 15:21 Modified: 06/02/10 15:21 Read: times |
#176355 - 80C52 Timer0 |
Hello,
I can't understand why my timer0 can't count on my 80C52 : It have to generate a frequency around 8kHz but the STOR don't switch up and down I init the timer like this : Timer0_init() { ET0 = 0; TR0 = 0; TMOD &= 0xF0; TMOD |= 1; TL0 = 115; TH0 = 0; TR0 = 1; ET0 = 1; } and next my interrupt looks like this : void ItTimer0(void) interrupt 1 using 2 { EA = 0; ET0 = 0; STOR1 ^= 1; TL0 = 115; TH0 = 0; ET0 = 1; EA = 1; } I call Timer0_init in the main function Thanks a lot if you can give me some hints |
Topic | Author | Date |
80C52 Timer0 | 01/01/70 00:00 | |
where is the EA initialize? | 01/01/70 00:00 | |
EA initialize | 01/01/70 00:00 | |
no reason in what you show | 01/01/70 00:00 | |
TL0 and TH0 | 01/01/70 00:00 | |
Calculations for Timer T0 at 8KHz: have you tried 0xFF8D ??? | 01/01/70 00:00 | |
correction | 01/01/70 00:00 | |
Yeah - 0x8D | 01/01/70 00:00 | |
Thanks for that typo, More for 8KHz with 50% duty cycle | 01/01/70 00:00 | |
Put the compiler to work... | 01/01/70 00:00 | |
fine, but | 01/01/70 00:00 | |
T0 overflows at 65535+1, don't overlook this | 01/01/70 00:00 | |
right answer, wrong premise | 01/01/70 00:00 | |
Exact calculations require semantics | 01/01/70 00:00 | |
you are welcome to find out | 01/01/70 00:00 | |
Thanks for the correction...![]() | 01/01/70 00:00 |