Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

24 total results found

1. Introduction to AVR Timers

Embedded System (MBD) Module 5 - Timer

1.1. Overview The ATmega328P is a widely popular 8-bit microcontroller, serving as the "brain" for many embedded systems, most notably the Arduino Uno. Among its most critical peripherals are the Timers. These components allow the microcontroller to perform ti...

2. Operating Modes

Embedded System (MBD) Module 5 - Timer

2.1. Normal Mode In Normal Mode, the timer acts as a simple up-counter. It starts from 0 and increments with every clock pulse (after passing through the prescaler) until it reaches its maximum value (0xFF for 8-bit, 0xFFFF for 16-bit. Once it hits the maximu...

3. Timer0

Embedded System (MBD) Module 5 - Timer

3.1. TCNT0 (Timer/Counter 0 Register) The TCNT0 register is the core component of the 8-bit TIMER0 module. It acts as the actual counter that holds the current timer value. The value of TCNT0 increments (or decrements in certain PWM modes) based on the select...

4. Timer1

Embedded System (MBD) Module 5 - Timer

4.1. TCNT1 (Timer/Counter Register) TCNT1 is functionally the same as TCNT0, serving as the core counter for its respective module, with several significant additions and architectural differences. TCNT1 is a 16-bit register divided into two 8-bit register, T...

5. Delay Using Timers

Embedded System (MBD) Module 5 - Timer

5.1. Delay Calculation in Normal Mode In Normal Mode, the timer always counts up to its maximum value and then overflows. To get a specific delay, you preload the TCNTn register with a starting value so it only has to count a specific number of steps before ov...

6. Der Code

Embedded System (MBD) Module 5 - Timer

6.1. Code Example 1 (Timer0) This code toggles PD5 every 0.5s. The delay_timer0 subroutine uses Timer0 in CTC Mode with a 1024 prescaler and a compare value of 156, creating a 10ms hardware delay per call. This subroutine is called 50 times using software loo...