Microcontroller › 8051 › help to programing 8051 timer › Your timer module get a
May 30, 2012 at 5:12 pm
#7941
Participant
Your timer module get a clock for every 4(I guess) cloks from the crystal oscillator.
And you know the time period of the crystal you are using. Just divide that time period with 4 to get the time period of clock which goes to the timer module.
Now as you need 20ms time period, just calculate how many clocks you need. Set the register values in such a way that it will overflow and generate an interrupt after that much clocks.
Learn the datasheet for more clear and detailed information.