![]() I don't understand how calculate TH0 and TL0 value I am stuck here The registers of Timers are loaded with some initial value. In my calculation timer should be run 460829 times in 5 second Total count by 16 bit counter = 65,536 ticks lets suppose I am using timer 0 and mode 1 When interrupt happen, LED should be turn ON, otherwise it should be turn off. Program: I want to set interrupt for 5 seconds. Similarly TL1 and TH1 are registers assigned to Timer 1. For example, register of Timer0 is accessed as TL0 for lower byte and TH0 for higher byte. Since AT89C51 is an 8 bit controller, the registers of AT89C51 Timers are accessed as two different registers one for lower byte and other for higher byte. So the maximum allowed counts in value of Timer registers can be from 0000H to FFFFH. maximum number of times a timer can count without repeating is 216, i.e., 65536. Timer takes a time period of one machine cycle to count one. The value of a Timer register increases by one every time a timer counts. Each of these timers is assigned a 16-bit register. One timer is TIMER0 and the other is TIMER1. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
May 2023
Categories |