Arduino Uno code explanation

6 years 7 months ago #993 by owenk04
Hello,

I just build the shield and tried the code source on my arduino and everything seems to works fine :)

I just wanted some explanation of the arduino code, especially the ISR part.
Indeed, i guessed that interrupt only occur when there is a trigger on the Pin ICP1, or when the ACSR registrer is correctly configured to be triggered via the analog comparator, but there is nothing wired to the ICP1 and the ACSR is not configured, so ... how this ISR is triggered ?

Maybe I missed something in the registers configuration ?

Thanks for your help in understanding this :)

Please Log in to join the conversation.

6 years 7 months ago - 6 years 7 months ago #996 by Ray
Replied by Ray on topic Arduino Uno code explanation

Rendering Error in layout Message/Item: array_keys(): Argument #1 ($array) must be of type array, null given. Please enable debug mode for more information.

Please Log in to join the conversation.

6 years 7 months ago #999 by owenk04
Thanks for your reply, I dug a lot in the atmel datasheet, and I finally understand that "TIMER1_CAPT_vect" interrupt vector is launch when the ICF Flag is set, but the ICF is not only driven by the ICP1 pin, but also by the counter 1 : ICF Flag is set when the counter reaches the TOP value due to the current WGM1 configuration (ICR1 as top value).

So I fully understand this sketch now, thanks !
The following user(s) said Thank You: Ray

Please Log in to join the conversation.

Time to create page: 0.078 seconds