3.14.6 12-bit Timer/Counter D with PWM

One 12-bit PWM Timer/Counter type D (TCD) optimized for power control

3.14.6.1 Introduction

The Timer/Counter type D (TCD) is a flexible 12-bit timer that can perform complex actions as well as the basic functions of a simple timer. The TCD is a high-performance waveform generator consisting of a counter that can run on a clock which is asynchronous to the peripheral clock, a prescaler, as well as compare, capture and control logic. The compare logic generates two independent outputs with optional dead time. The TCD is also connected to the Event System for capture and deterministic fault control. The timer/counter can generate interrupts and events on compare match and overflow.

3.14.6.2 Supported Device Families

AVR® DxAVR® ExATtinyATmega

3.14.6.3 Required Header Files

#include "mcc_generated_files/timer/tcd[X].h"
Note: Replace [X] with the selected instance number of the TCD module.

3.14.6.4 Module Documentation

3.14.6.4.1 TCD

This file contains the API prototypes for the TCD driver.

Module description

This file contains the API prototypes for the TCD driver.

Version: TCD0 Driver Version 1.0.1
Functions
  • int8_t TCD_Initialize ()

    Initializes the TCD interface.

  • void TCD_SetTRIGIsrCallback (TCD0_cb_t cb)

    Interrupt Service Routine (ISR) callback function to be called if the Trigger Input Interrupt flag is set.

  • void TCD_SetOVFIsrCallback (TCD0_cb_t cb)

    ISR callback function to be called if the Counter Overflow flag is set.

Function Documentation

TCD_Initialize()

int8_t TCD_Initialize ( )

Initializes the TCD interface.

Parameters:
None.
Return values:
0

- TCD initialization was successful.

1

- TCD initialization was not successful.

TCD_SetOVFIsrCallback()

void TCD_SetOVFIsrCallback (TCD0_cb_t cb)

ISR callback function to be called if the Counter Overflow flag is set.

Parameters:
TCD0_cb_t

cb - Callback function for the counter overflow event.

Returns:

None.

TCD_SetTRIGIsrCallback()

void TCD_SetTRIGIsrCallback (TCD0_cb_t cb)

Interrupt Service Routine (ISR) callback function to be called if the Trigger Input Interrupt flag is set.

Parameters:
TCD0_cb_t

cb - Callback function for the trigger input event.

Returns:

None.

3.14.6.4.2 TIMER INTERFACE

This file contains API prototypes and other data types for the Timer module.

Version: Timer Interface Version 1.0.0

3.14.6.5 Class Documentation

3.14.6.5.1 TMR_INTERFACE Struct Reference

#include <timer_interface.h>

Member Data Documentation

The documentation for this struct was generated from the following file:

source/

timer_interface.h

Initialize

void(* TMR_INTERFACE::Initialize) (void)

PeriodCountSet

void(* TMR_INTERFACE::PeriodCountSet) (size_t count)

Start

void(* TMR_INTERFACE::Start) (void)

Stop

void(* TMR_INTERFACE::Stop) (void)

Tasks

void(* TMR_INTERFACE::Tasks) (void)

TimeoutCallbackRegister

void(* TMR_INTERFACE::TimeoutCallbackRegister) (void(*CallbackHandler)(void))

3.14.6.6 File Documentation

3.14.6.6.1 source/tcd0.c File Reference

This file contains the API implementations for the TCD driver.

#include "../tcd0.h"

Detailed Description

This file contains the API implementations for the TCD driver.

TCD0 Generated Driver File

Version: TCD Driver Version 2.0.2

Function Documentation

ISR()[1/2]

ISR (TCD0_OVF_vect )

ISR()[2/2]

ISR (TCD0_TRIG_vect )

TCD_SetOVFIsrCallback()

void TCD_SetOVFIsrCallback (TCD_cb_t cb)

TCD_SetTRIGIsrCallback()

void TCD_SetTRIGIsrCallback (TCD_cb_t cb)

Variable Documentation

TCD_OVF_isr_cb

void(* TCD_OVF_isr_cb) (void) = NULL

TCD_TRIG_isr_cb

void(* TCD_TRIG_isr_cb) (void) = NULL

3.14.6.6.2 source/tcd0.h File Reference

#include "../system/utils/compiler.h"
#include "../system/ccp.h"

Functions

  • int8_t TCD_Initialize ()

    Initializes the TCD interface.

  • void TCD_SetTRIGIsrCallback (TCD0_cb_t cb)

    Interrupt Service Routine (ISR) callback function to be called if the Trigger Input Interrupt flag is set.

  • void TCD_SetOVFIsrCallback (TCD0_cb_t cb)

    ISR callback function to be called if the Counter Overflow flag is set.

Typedefs

Detailed Description

TCD0 Generated Driver API Header File

Typedef Documentation

TCD_cb_t

typedef void(* TCD_cb_t) (void)

3.14.6.6.3 source/timer_interface.h File Reference

#include <stddef.h>

Detailed Description

Timer Interface Generated Driver API Header File