Arduino Timer 1 Calculator

CTC Mode

Inputs Results
Arduino ATmega328p timer/counter1 CTC diagram

About Arduino Timer 1 CTC Mode Calculator

The CTC Mode calculator helps you calculate the timer/counter 1 count value (C) to load into the OCR1 register for a given CPU frequency and desired output wave frequency.

Equations Used

\(C=\frac{F_{osc}}{2 N F_{w}}-1\)
where Fosc is the CPU frequency, Fw is the output wave frequency and N is the pre-scalar value.

Fast PWM Mode

Non-Inverted Mode Results

Inverted Mode

Results
Arduino Timer 1 Fast PWM mode diagram

About Arduino Timer 1 Fast PWM Mode Calculator

The Fast PWM calculator calculates the wave frequency and OCR1 register value for both non-inverted and inverted modes.

Equations Used

\(F_{w}=\frac{F_{osc}}{256N}\)
\(OCR1_{non\text{-}inv} = \frac{256D}{100} - 1\)
\(OCR1_{inv} = 255 - \frac{256D}{100}\)

Phase Correct PWM Mode

Non-Inverted Mode Results

Inverted Mode

Results
Arduino Timer 1 Phase Correct PWM mode

About Arduino Timer 1 Phase Correct PWM Mode Calculator

The Phase Correct PWM calculator calculates the wave frequency and OCR1 register value for both non-inverted and inverted modes.

Equations Used

\(F_{w}=\frac{F_{osc}}{510N}\)
\(OCR1_{non\text{-}inv} = \frac{255D}{100}\)
\(OCR1_{inv} = 255 - \frac{255D}{100}\)

Post a Comment