![codevision timer examples codevision timer examples](https://www.avrfreaks.net/sites/default/files/avcalc.png)
We just need to calculate the values required for the timer. The same register is used to control the interrupt of timer 1.
#CODEVISION TIMER EXAMPLES HOW TO#
If you want to know about the basic of prescaler and how to initialize it, do check out this article. Do note that, I have taken 64 as a prescaler. On dividing, the value is Now we know how to set the timer interrupt of timer 0, we are ready to program. But, if we divide the value to the delay required, we can know how many time the timer have to overflow to generate the delay of 1sec. Now, we know how much time the controller takes to count the value till 8 bit. As I have already stated above, the prescaler I am choosing is This results the frequency of the controller is Therefore, the time period of the controller should be 16 microseconds. After that, I am calculating the number of times it should overflow to generate the delay of 1sec. See, we know that the delay is very large so, I am choosing 8 as a prescaler.
![codevision timer examples codevision timer examples](https://www.avrfreaks.net/sites/default/files/oled_0.jpg)
We need a bit of calculation before writing the code. The operating frequency of the microcontroller is 4 MHz. Suppose we have to generate a blink the LED in 1 sec interval. If you want to learn the basic of timers, check out my previous articles before continuing to this. In this article, we are going to learn how to initialize the timer interrupt for Timer0 as well as Timer1.