4.24.3.1 TMR2
Timer2
4.24.3.1.1 Introduction
The Timer2 (TMR2) module is a 8-bit timer that operates by a matching the value written to a configurable 8-bit period register. It has adjustable prescaler, postscaler, and the added feature of interrupt triggers.
4.24.3.1.2 Supported Device Families
PIC12/16F150x | PIC12/16F157x | PIC12/16F184x |
PIC12/16LF155x | PIC16F145x | PIC16F151x |
PIC16F152x | PIC16F170x | PIC16F171x |
PIC16F178x | PIC16F183xx | PIC16F194x |
PIC16LF156x | PIC18F-K20 | PIC18F-K22 |
PIC18F-K50 | PIC18F-K80 | PIC18F-K90 |
4.24.3.1.3 Required header files:
#include "mcc_generated_files/timer/tmr2.h"
4.24.3.1.5 File Documentation
source/tmr2.c File Reference
API implementations for the TMR2 module.
#include <xc.h> #include "../tmr2.h"
Functions
static void TMR2_DefaultOverflowCallback (void)
void TMR2_Initialize (void)
Initializes the TMR2 module. This routine must be called before any other timer routines.
void TMR2_Start (void)
Starts TMR2.
void TMR2_Stop (void)
Stops TMR2.
uint8_t TMR2_Read (void)
Reads the 8-bit from the TMR2 register.
void TMR2_Write (uint8_t timerVal)
Writes the 8-bit value to the TMR2 register.
void TMR2_PeriodCountSet (size_t periodVal)
Loads the 8-bit value to the PR2 register.
void TMR2_ISR (void)
Interrupt Service Routine (ISR) for TMR2 overflow interrupt.
void TMR2_OverflowCallbackRegister (void(*InterruptHandler)(void))
Setter function for the TMR2 overflow callback.
void TMR2_Tasks (void)
Performs the tasks to be executed on timer overflow event if interrupts are not enabled.
Variables
static void(* TMR2_OverflowCallback )(void)
Detailed Description
API implementations for the TMR2 module.
TMR2 Generated Driver File
Function Documentation
TMR2_DefaultOverflowCallback()
static void TMR2_DefaultOverflowCallback (void )[static]
Variable Documentation
TMR2_OverflowCallback
void(* TMR2_OverflowCallback) (void)[static]
Section: Included Files
source/tmr2.h File Reference
#include <stdint.h> #include <stdbool.h>
Functions
void TMR2_Initialize (void)
Initializes the TMR2 module. This routine must be called before any other timer routines.
void TMR2_Start (void)
Starts TMR2.
void TMR2_Stop (void)
Stops TMR2.
uint8_t TMR2_Read (void)
Reads the 8-bit from the TMR2 register.
void TMR2_Write (uint8_t timerVal)
Writes the 8-bit value to the TMR2 register.
void TMR2_PeriodCountSet (size_t periodVal)
Loads the 8-bit value to the PR2 register.
void TMR2_ISR (void)
Interrupt Service Routine (ISR) for TMR2 overflow interrupt.
void TMR2_Tasks (void)
Performs the tasks to be executed on timer overflow event if interrupts are not enabled.
void TMR2_OverflowCallbackRegister (void(*InterruptHandler)(void))
Setter function for the TMR2 overflow callback.
Detailed Description
TMR2 Generated Driver API Header File