all right, so i have successfully done my first interrupt programming. but i am still not sure how often does the program go into the interrupt. Since i dont have an oscilloscope to verify the timing. so my guesses is all based on calculations.
I am using a 8bit timer/counter, 16Mhz crystals and the interrupt setting is overflowing with 1024 prescaler.
in the datasheet, i found this equation: f_ocnx=f_clock_IO/(2*N*(1+OCRnx))
so i guess my OCRnx is 256, wince i am using a 8 bit counter. And if i am not wrong. my N will be 1024 and f_clock_IO is 16Mhz
So does it means the interrupt will execute at [f_ocnx= 16Mhz/(2*1024*(1+255))] 30.51Hz, which also mean every 32.7ms.
is my calulation correct? and also, can anyone tell me why is there a 2 in the denominator?
Thanks
I am using a 8bit timer/counter, 16Mhz crystals and the interrupt setting is overflowing with 1024 prescaler.
in the datasheet, i found this equation: f_ocnx=f_clock_IO/(2*N*(1+OCRnx))
so i guess my OCRnx is 256, wince i am using a 8 bit counter. And if i am not wrong. my N will be 1024 and f_clock_IO is 16Mhz
So does it means the interrupt will execute at [f_ocnx= 16Mhz/(2*1024*(1+255))] 30.51Hz, which also mean every 32.7ms.
is my calulation correct? and also, can anyone tell me why is there a 2 in the denominator?
Thanks