This post is about Timer/Counter and Interrupt of Arduino for accurate time control. If you are working on time sensitive project, Timer and Interruput would be better than delay() function.
I used Arduino UNO R3. But I explained the whole process in general from finding MCU model.
To use timer and interrupt, you should access to the register of MCU. We need datasheet of our MCU.
MCU of UNO R3 is ATMega328P. Memory of timer and interrupt differs by MCU models. Find yours if you use different model.
Now find datasheet of MCU.
FIND DOCS ON OFFICIAL WEBSITE ALWAYS!!
In ATMEL site, I searched ATMega328P.
This is what I used.
Searching "Timer/Counter", my MCU has two 8-bit timers and one 16-bit timer. What's the difference? Choose appropriate one for considering formula below.
params
: Output Frequency You Want (Hz)
: Clock Frequency of Timer/Counter (32MHz for ATMega328P)
: Prescaler
: Top Value (to find!)
Top이 그 머야.. bit 수 머시기
In my case, it was for external trigger of multi camera time sync.
cont.....