# Caclulating Duty cycle and Frequncy

I am slightly confused how I would calculate the duty cycle and frequency for the following:

Arduino Nano: 16-Bbit TIMER 1, with16MHz F_CPU

Prescaled by 8, giving 2MHz.

is the following correct?

Max ticks = 65535

Example. value 300 is loaded into timer, therefore timer will run for 301 clock periods.

Output A frequency: 16 MHz / 8 / 65536 // is this right??
Output A duty cycle: (300+1) / 65536 // ?

I also do not understand this sentence:

The timer block is set up to toggle the OC1A pin every time the timer reaches 0, so the period of the signal given out on the pin will be double

What WGM have you configured timer 1 for? How is OC1A pin being toggled? What interrupts (if any) are in use?

Regarding the last sentence, in some timer configurations, the timer counts up to max value and then back down to zero. Depending on the configuration, different interrupts will occur at different times in this process - this will impact the period.

Look at the graphics in the datasheet - they are very helpful for understanding this.