The ISR preamble takes about 42 CPU cycles to execute there is overhead to execute the interrupt, disable global interrupts and to save registers. If you reset the counter inside your interrupt service routine then you are going to have to account for the drift introduced by running the code. If you want accurate timing, say for sampling a serial UART input, then you are much better off using the hardware to reset the counter as there will be no lag. Can you give me a hint on what is going on?I did not find any info on how to calculate timing on timer 1.It seems different than normal timer0 I can manually trial and error tweak for the value I need but this is not professional. I cleared before TCCR1=0 so does not have other prescaler set. (1/clock)*prescaler=Timer tick.I get totally different timing than one expected.I load the time on OCR1A and toggle some pins the time is much less. The problem is that about any prescaler I chose lets say on internal clock 8Mhz with normal formula. All tutorials are dealing with timer0, Timer 1 is a particular one is not compatible with others, It has precallers from 1/2-1/16384 Synchronous Clocking Mode. I did not find much information about how can you calculate the time using timer1 on Atiny 85.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |