## Normal Mode

**Equations Used:**

\(C=256-\frac{F_{CPU}}{N F_{d}}\)

where, N is the pre-scalar value

\(F_d=\frac{1}{T_d}\)

where \(T_d\) is the required time delay

The timer CPU period is, \(T_{CPU}=N\times(\frac{1}{F_{CPU}})\)

and the number of CPU clocks required for the specified time delay is, \(N_c=\frac{T_d}{T_{CPU}}\)

### About Normal Mode Calculator/Time Delay Calculator

The above online Normal Mode calculator helps you to calculate the timer/counter 0 count value(C) that is to be loaded into the TCNT0 register for given CPU frequency(oscillator frequency, F_{CPU}) and required time delay(T_{d}). It also calculates the CPU time period for given CPU frequency and the number of clocks or ticks that is required for specified time delay. This calculator can be used for making time delay routine for ATmega32, ATMega328p and Arduino. This is illustrated in the tutorial Time delay using timers without inbuild functions in Arduino.

The following are links to worked out examples with normal mode online calculator.

## CTC Mode

**Equations Used:**

\(C=\frac{F_{osc}}{2 N F_{w}}-1\)

where, F

_{osc}is the frequency of the CPU, F

_{w}is the output square wave frequency and N is the pre-scalar value.

### About CTC mode Calculator

The above online CTC Mode calculator helps you to calculate the timer/counter 0 count value(C) that is to be loaded into the OCR0 register(Output Compare Register 0) for given CPU frequency(or oscillator frequency, F_{osc}) and desired output wave frequency(F

_{w}).The following are links to worked out examples with online CTC mode calculator.

- Programming ATmega328p in CTC mode

- Arduino CTC mode Programming with Examples

## Fast PWM Mode

**Equations Used:**

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

### About Fast PWM Calculator

The above online Fast PWM calculator calculates the wave frequency and count value to be loaded into OCR0 register for non-inverted and inverted mode.The following are links to worked out examples for Fast PWM mode:- ATmega328P Fast PWM mode Programming Examples - Programming Arduino Timer 0 in Fast PWM mode - Programming Arduino Timer 1 in Fast PWM mode - Programming Arduino Timer 2 in Fast PWM mode

## Phase Correct PWM Mode

**Equations Used:**

\(F_{w(non-inv)}=\frac{Fosc}{510N},\) \(OCR0_{non-inv}= \frac{255D}{100},\) \(F_{w(non-inv)}=\frac{Fosc}{510N},\) \(OCR0_{non-inv}= 255 - \frac{255D}{100}\)

### About Phase Correct PWM Calculator

The above online Phase Correct PWM calculator calculates the wave frequency and count value to be loaded into OCR0 register for non-inverted and inverted mode. The followings are links to worked out examples with phase correct PWM online calculator:

- Phase Correct PWM with ATmega328P - Programming Timer Counter in Phase Correct PWM mode with ATmega32