Solar panel
Loading...
Searching...
No Matches
tmr0.c File Reference
#include <xc.h>
#include "tmr0.h"

Go to the source code of this file.

Functions

void TMR0_Initialize (void)
 
void TMR0_StartTimer (void)
 
void TMR0_StopTimer (void)
 
uint16_t TMR0_ReadTimer (void)
 
void TMR0_WriteTimer (uint16_t timerVal)
 
void TMR0_Reload (void)
 
void TMR0_ISR (void)
 
void TMR0_SetInterruptHandler (void(*InterruptHandler)(void))
 
void TMR0_DefaultInterruptHandler (void)
 

Variables

void(* TMR0_InterruptHandler )(void)
 
volatile uint16_t timer0ReloadVal
 

Function Documentation

◆ TMR0_DefaultInterruptHandler()

void TMR0_DefaultInterruptHandler ( void  )

@Summary Default Timer Interrupt Handler

@Description This is the default Interrupt Handler function

@Preconditions Initialize the TMR0 module with interrupt before calling this isr.

@Param None

@Returns None

Definition at line 160 of file tmr0.c.

◆ TMR0_Initialize()

void TMR0_Initialize ( void  )

Section: TMR0 APIs

Definition at line 67 of file tmr0.c.

◆ TMR0_ISR()

void TMR0_ISR ( void  )

@Summary Timer Interrupt Service Routine

@Description Timer Interrupt Service Routine is called by the Interrupt Manager.

@Preconditions Initialize the TMR0 module with interrupt before calling this isr.

@Param None

@Returns None

Definition at line 136 of file tmr0.c.

◆ TMR0_ReadTimer()

uint16_t TMR0_ReadTimer ( void  )

@Summary Reads the 16 bits TMR0 register value.

@Description This function reads the 16 bits TMR0 register value and return it.

@Preconditions Initialize the TMR0 before calling this function.

@Param None

@Returns This function returns the 16 bits value of TMR0 register.

@Example Initialize TMR0 module

Start TMR0 TMR0_StartTimer();

Read the current value of TMR0 if(0 == TMR0_ReadTimer()) { Do something else...

Reload the TMR value TMR0_Reload(); }

Definition at line 109 of file tmr0.c.

◆ TMR0_Reload()

void TMR0_Reload ( void  )

@Summary Reload the 16 bits value to TMR0 register.

@Description This function reloads the 16 bit value to TMR0 register. This function must be called to write initial value into TMR0 register.

@Preconditions Initialize the TMR0 before calling this function.

@Param None

@Returns None

@Example while(1) { if(TMR0IF) { Do something else...

clear the TMR0 interrupt flag TMR0IF = 0;

Reload the initial value of TMR0 TMR0_Reload(); } }

Definition at line 129 of file tmr0.c.

◆ TMR0_SetInterruptHandler()

void TMR0_SetInterruptHandler ( void(*)(void)  InterruptHandler)

@Summary Set Timer Interrupt Handler

@Description This sets the function to be called during the ISR

@Preconditions Initialize the TMR0 module with interrupt before calling this.

@Param Address of function to be set

@Returns None

Definition at line 156 of file tmr0.c.

◆ TMR0_StartTimer()

void TMR0_StartTimer ( void  )

@Summary This function starts the TMR0.

@Description This function starts the TMR0 operation. This function must be called after the initialization of TMR0.

@Preconditions Initialize the TMR0 before calling this function.

@Param None

@Returns None

@Example Initialize TMR0 module

Start TMR0 TMR0_StartTimer();

Do something else...

Definition at line 97 of file tmr0.c.

◆ TMR0_StopTimer()

void TMR0_StopTimer ( void  )

@Summary This function stops the TMR0.

@Description This function stops the TMR0 operation. This function must be called after the start of TMR0.

@Preconditions Initialize the TMR0 before calling this function.

@Param None

@Returns None

@Example Initialize TMR0 module

Start TMR0 TMR0_StartTimer();

Do something else...

Stop TMR0; TMR0_StopTimer();

Definition at line 103 of file tmr0.c.

◆ TMR0_WriteTimer()

void TMR0_WriteTimer ( uint16_t  timerVal)

@Summary Writes the 16 bits value to TMR0 register.

@Description This function writes the 16 bits value to TMR0 register. This function must be called after the initialization of TMR0.

@Preconditions Initialize the TMR0 before calling this function.

@Param timerVal - Value to write into TMR0 register.

@Returns None

@Example #define PERIOD 0x8000 #define ZERO 0x0000

while(1) { Read the TMR0 register if(ZERO == TMR0_ReadTimer()) { Do something else...

Write the TMR0 register TMR0_WriteTimer(PERIOD); }

Do something else... }

Definition at line 122 of file tmr0.c.

Variable Documentation

◆ timer0ReloadVal

volatile uint16_t timer0ReloadVal

Definition at line 60 of file tmr0.c.

◆ TMR0_InterruptHandler

void(* TMR0_InterruptHandler) (void) ( void  )

TMR0 Generated Driver File

@Company Microchip Technology Inc.

@File Name tmr0.c

@Summary This is the generated driver implementation file for the TMR0 driver using PIC10 / PIC12 / PIC16 / PIC18 MCUs

@Description This source file provides APIs for TMR0. Generation Information : Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8 Device : PIC18F97J60 Driver Version : 2.01 The generated drivers are tested against the following: Compiler : XC8 2.36 and above MPLAB : MPLAB X 6.00 Section: Included Files Section: Global Variables Definitions

Definition at line 58 of file tmr0.c.