3.14.3 8-bit Timer/Counter2 with Async PWM
8-bit Timer/Counter2 with PWM and Asynchronous Operation
3.14.3.1 Introduction
The Timer/Counter2 is a general purpose, single channel, 8-bit Timer/Counter module. The Timer/Counter can be clocked internally, via the prescaler, or asynchronously clocked from the TOSC1/2 pins, as detailed later in this section. The asynchronous operation is controlled by the asynchronous status register (ASSR). The clock select logic block controls which clock source he Timer/Counter uses to increment (or decrement) its value. The Timer/Counter is inactive when no clock source is selected. The output from the clock select logic is referred to as the timer clock (clkT2).
3.14.3.2 Supported Device Families
ATmegaxxx |
3.14.3.3 Required Header Files
#include "mcc_generated_files/tc2/tc2.h"
3.14.3.4 Module Documentation
3.14.3.4.1 TC2
This file contains the API prototypes and other data types for the Timer Counter 2 (TC2) driver.
Module description
This file contains the API prototypes and other data types for the Timer Counter 2 (TC2) driver.
Functions
int8_t TC2_Initialize (void)
Initializes the TC2 module.
bool TC2_Get_Overflow_InterruptFlagStatus (void)
Checks the overflow Interrupt flag status of the TC2 module.
bool TC2_Get_COM2A_InterruptFlagStatus (void)
Checks the Compare A interrupt flag status of the TC2 module.
bool TC2_Get_COM2B_InterruptFlagStatus (void)
Checks the Compare B interrupt flag status of the TC2 module.
void TC2_Enable_Overflow_Interrupt (void)
Enables the overflow interrupt of the TC2 module.
void TC2_Disable_Overflow_Interrupt (void)
Disables the overflow interrupt of the TC2 module.
void TC2_Enable_COM2A_Interrupt (void)
Enables the Compare A interrupt of the TC2 module.
void TC2_Disable_COM2A_Interrupt (void)
Disables the Compare A interrupt of the TC2 module.
void TC2_Enable_COM2B_Interrupt (void)
Enables the Compare B interrupt of the TC2 module.
void TC2_Disable_COM2B_Interrupt (void)
Disables the Compare B interrupt of the TC2 module.
void TC2_WriteTimer (uint8_t timerValue)
Writes a value to the TC2 timer register.
uint8_t TC2_ReadTimer (void)
Reads the timer value of the TC2 module.
Function Documentation
TC2_Disable_COM2A_Interrupt()
void TC2_Disable_COM2A_Interrupt (void )
Disables the Compare A interrupt of the TC2 module.
|
None. |
TC2_Disable_COM2B_Interrupt()
void TC2_Disable_COM2B_Interrupt (void )
Disables the Compare B interrupt of the TC2 module.
|
None. |
TC2_Disable_Overflow_Interrupt()
void TC2_Disable_Overflow_Interrupt (void )
Disables the overflow interrupt of the TC2 module.
|
None. |
TC2_Enable_COM2A_Interrupt()
void TC2_Enable_COM2A_Interrupt (void )
Enables the Compare A interrupt of the TC2 module.
|
None. |
TC2_Enable_COM2B_Interrupt()
void TC2_Enable_COM2B_Interrupt (void )
Enables the Compare B interrupt of the TC2 module.
|
None. |
TC2_Enable_Overflow_Interrupt()
void TC2_Enable_Overflow_Interrupt (void )
Enables the overflow interrupt of the TC2 module.
|
None. |
TC2_Get_COM2A_InterruptFlagStatus()
bool TC2_Get_COM2A_InterruptFlagStatus (void )
Checks the Compare A interrupt flag status of the TC2 module.
|
|
TC2_Get_COM2B_InterruptFlagStatus()
bool TC2_Get_COM2B_InterruptFlagStatus (void )
Checks the Compare B interrupt flag status of the TC2 module.
|
|
TC2_Get_Overflow_InterruptFlagStatus()
bool TC2_Get_Overflow_InterruptFlagStatus (void )
Checks the overflow Interrupt flag status of the TC2 module.
|
|
TC2_Initialize()
int8_t TC2_Initialize (void )
Initializes the TC2 module.
|
|
TC2_ReadTimer()
uint8_t TC2_ReadTimer (void )
Reads the timer value of the TC2 module.
|
|
TC2_WriteTimer()
void TC2_WriteTimer (uint8_t timerValue)
Writes a value to the TC2 timer register.
|
None. |
3.14.3.5 File Documentation
3.14.3.5.1 source/tc2.c File Reference
This file contains the API implementation for the Timer Counter 2 (TC2) module driver.
#include <avr/io.h> #include "../tc2.h"
Functions
int8_t TC2_Initialize (void)
Initializes the TC2 module.
bool TC2_Get_Overflow_InterruptFlagStatus (void)
Checks the overflow Interrupt flag status of the TC2 module.
bool TC2_Get_COM2A_InterruptFlagStatus (void)
Checks the Compare A interrupt flag status of the TC2 module.
bool TC2_Get_COM2B_InterruptFlagStatus (void)
Checks the Compare B interrupt flag status of the TC2 module.
void TC2_Enable_Overflow_Interrupt (void)
Enables the overflow interrupt of the TC2 module.
void TC2_Disable_Overflow_Interrupt (void)
Disables the overflow interrupt of the TC2 module.
void TC2_Enable_COM2A_Interrupt (void)
Enables the Compare A interrupt of the TC2 module.
void TC2_Disable_COM2A_Interrupt (void)
Disables the Compare A interrupt of the TC2 module.
void TC2_Enable_COM2B_Interrupt (void)
Enables the Compare B interrupt of the TC2 module.
void TC2_Disable_COM2B_Interrupt (void)
Disables the Compare B interrupt of the TC2 module.
void TC2_WriteTimer (uint8_t timerValue)
Writes a value to the TC2 timer register.
uint8_t TC2_ReadTimer (void)
Reads the timer value of the TC2 module.
ISR (TIMER2_COMPA_vect)
ISR (TIMER2_COMPB_vect)
Detailed Description
This file contains the API implementation for the Timer Counter 2 (TC2) module driver.
TC2 Generated Driver File
Function Documentation
ISR()[1/2]
ISR (TIMER2_COMPA_vect )
ISR()[2/2]
ISR (TIMER2_COMPB_vect )
3.14.3.5.2 source/tc2.h File Reference
#include "../system/utils/compiler.h" #include <stdint.h> #include <stdbool.h>
Functions
int8_t TC2_Initialize (void)
Initializes the TC2 module.
bool TC2_Get_Overflow_InterruptFlagStatus (void)
Checks the overflow Interrupt flag status of the TC2 module.
bool TC2_Get_COM2A_InterruptFlagStatus (void)
Checks the Compare A interrupt flag status of the TC2 module.
bool TC2_Get_COM2B_InterruptFlagStatus (void)
Checks the Compare B interrupt flag status of the TC2 module.
void TC2_Enable_Overflow_Interrupt (void)
Enables the overflow interrupt of the TC2 module.
void TC2_Disable_Overflow_Interrupt (void)
Disables the overflow interrupt of the TC2 module.
void TC2_Enable_COM2A_Interrupt (void)
Enables the Compare A interrupt of the TC2 module.
void TC2_Disable_COM2A_Interrupt (void)
Disables the Compare A interrupt of the TC2 module.
void TC2_Enable_COM2B_Interrupt (void)
Enables the Compare B interrupt of the TC2 module.
void TC2_Disable_COM2B_Interrupt (void)
Disables the Compare B interrupt of the TC2 module.
void TC2_WriteTimer (uint8_t timerValue)
Writes a value to the TC2 timer register.
uint8_t TC2_ReadTimer (void)
Reads the timer value of the TC2 module.
Detailed Description
TC2 Generated Driver API Header File