3.14.2 HLVD with Positive/Negative going Interrupts
High/Low-Voltage Detect with Positive/Negative going Interrupts
3.14.2.1 Introduction
The High/Low-Voltage Detect (HLVD) module can be configured to monitor the device voltage. This is useful in battery monitoring applications. This variant of the module has operation modes that can individually monitor the voltage rise and drop of the input voltage or both.
3.14.2.2 Supported Device Families
PIC18F-K4x | PIC18F-K83 | PIC18F-Q10 |
PIC18F-Q2x | PIC18F-Q4x | PIC18F-Q8x |
3.14.2.3 Required header files
#include "mcc_generated_files/hlvd/hlvd.h"
3.14.2.4 Module Documentation
3.14.2.4.1 HLVD
This file contains the API protoypes and related data structures for the HLVD driver.
Module description
This file contains the API protoypes and related data structures for the HLVD driver.
Enumerations
enum HLVD_TRIP_POINTS { HLVD_TRIP_POINT_1p81V = 0, HLVD_TRIP_POINT_2p00V = 1, HLVD_TRIP_POINT_2p20V = 2, HLVD_TRIP_POINT_2p40V = 3, HLVD_TRIP_POINT_2p50V = 4, HLVD_TRIP_POINT_2p70V = 5, HLVD_TRIP_POINT_2p80V = 6, HLVD_TRIP_POINT_3p00V = 7, HLVD_TRIP_POINT_3p30V = 8, HLVD_TRIP_POINT_3p50V = 9, HLVD_TRIP_POINT_3p60V = 10, HLVD_TRIP_POINT_3p80V = 11, HLVD_TRIP_POINT_4p00V = 12, HLVD_TRIP_POINT_4p20V = 13, HLVD_TRIP_POINT_4p50V = 14 }
Trip point values for the HLVD driver.
Functions
void HLVD_Initialize (void)
Initializes the HLVD module. This is called only once before calling other HLVD APIs.
void HLVD_Enable (void)
Enables the HLVD.
void HLVD_Disable (void)
Disables the HLVD.
bool HLVD_IsBandGapVoltageStable (void)
Returns the status of the band gap reference voltage.
void HLVD_TripPointSetup (bool Negative_Trip, bool Positive_Trip, HLVD_TRIP_POINTS trip_points)
Sets the positive, negative or both voltage trip interrupts and sets the trip point value.
bool HLVD_OutputStatusGet (void)
Returns the HLVD comparator output status.
void HLVD_CallbackRegister (void(*CallbackHandler)(void))
Sets the callback handler for the HLVD interrupt events.
void HLVD_Tasks (void)
Checks the status of the HLVD Interrupt Flag bit.
Function Documentation
HLVD_CallbackRegister()
void HLVD_CallbackRegister (void(*)(void) CallbackHandler)
Sets the callback handler for the HLVD interrupt events.
|
None. |
HLVD_Disable()
void HLVD_Disable (void )
Disables the HLVD.
HLVD_Initialize() and HLVD_IsBandGapVoltageStable() are already called. |
|
None. |
HLVD_Enable()
void HLVD_Enable (void )
Enables the HLVD.
|
None. |
HLVD_Initialize()
void HLVD_Initialize (void )
Initializes the HLVD module. This is called only once before calling other HLVD APIs.
Section: HLVD APIs
|
None. |
Section: HLVD Module APIs
HLVD_IsBandGapVoltageStable()
bool HLVD_IsBandGapVoltageStable (void )
Returns the status of the band gap reference voltage.
HLVD_Initialize() is already called. |
|
|
HLVD_OutputStatusGet()
bool HLVD_OutputStatusGet (void )
Returns the HLVD comparator output status.
|
|
HLVD_Tasks()
void HLVD_Tasks (void )
Checks the status of the HLVD Interrupt Flag bit.
|
None. |
HLVD_TripPointSetup()
void HLVD_TripPointSetup (bool Negative_Trip, bool Positive_Trip, HLVD_TRIP_POINTS trip_points)
Sets the positive, negative or both voltage trip interrupts and sets the trip point value.
|
None. |
Enumeration Type Documentation
HLVD_TRIP_POINTS
enum HLVD_TRIP_POINTS
Trip point values for the HLVD driver.
Section: Included FilesSection: Enum Declarations
HLVD_TRIP_POINT_1p81V | ||
HLVD_TRIP_POINT_2p00V | ||
HLVD_TRIP_POINT_2p20V | ||
HLVD_TRIP_POINT_2p40V | ||
HLVD_TRIP_POINT_2p50V | ||
HLVD_TRIP_POINT_2p70V | ||
HLVD_TRIP_POINT_2p80V | ||
HLVD_TRIP_POINT_3p00V | ||
HLVD_TRIP_POINT_3p30V | ||
HLVD_TRIP_POINT_3p50V | ||
HLVD_TRIP_POINT_3p60V | ||
HLVD_TRIP_POINT_3p80V | ||
HLVD_TRIP_POINT_4p00V | ||
HLVD_TRIP_POINT_4p20V | ||
HLVD_TRIP_POINT_4p50V |
3.14.2.5 File Documentation
3.14.2.5.1 source/hlvd.c File Reference
This file contains the API implementation for the HLVD driver.
#include "../hlvd.h"
Functions
static void HLVD_DefaultCallback (void)
void HLVD_Initialize (void)
Initializes the HLVD module. This is called only once before calling other HLVD APIs.
bool HLVD_IsBandGapVoltageStable (void)
Returns the status of the band gap reference voltage.
void HLVD_Enable (void)
Enables the HLVD.
void HLVD_Disable (void)
Disables the HLVD.
void HLVD_TripPointSetup (bool Negative_Trip, bool Positive_Trip, HLVD_TRIP_POINTS trip_points)
Sets the positive, negative or both voltage trip interrupts and sets the trip point value.
bool HLVD_OutputStatusGet (void)
Returns the HLVD comparator output status.
void HLVD_Tasks (void)
Checks the status of the HLVD Interrupt Flag bit.
void HLVD_CallbackRegister (void(*CallbackHandler)(void))
Sets the callback handler for the HLVD interrupt events.
Variables
static void(* HLVD_Callback )(void)
Detailed Description
This file contains the API implementation for the HLVD driver.
HLVD Generated Driver File.
Function Documentation
HLVD_DefaultCallback()
static void HLVD_DefaultCallback (void )[static]
Variable Documentation
HLVD_Callback
void(* HLVD_Callback) (void)[static]
Section: Included Files
3.14.2.5.2 source/hlvd.h File Reference
#include <xc.h> #include <stdint.h> #include <stdbool.h>
Functions
void HLVD_Initialize (void)
Initializes the HLVD module. This is called only once before calling other HLVD APIs.
void HLVD_Enable (void)
Enables the HLVD.
void HLVD_Disable (void)
Disables the HLVD.
bool HLVD_IsBandGapVoltageStable (void)
Returns the status of the band gap reference voltage.
void HLVD_TripPointSetup (bool Negative_Trip, bool Positive_Trip, HLVD_TRIP_POINTS trip_points)
Sets the positive, negative or both voltage trip interrupts and sets the trip point value.
bool HLVD_OutputStatusGet (void)
Returns the HLVD comparator output status.
void HLVD_CallbackRegister (void(*CallbackHandler)(void))
Sets the callback handler for the HLVD interrupt events.
void HLVD_Tasks (void)
Checks the status of the HLVD Interrupt Flag bit.
Enumerations
enum HLVD_TRIP_POINTS { HLVD_TRIP_POINT_1p81V = 0, HLVD_TRIP_POINT_2p00V = 1, HLVD_TRIP_POINT_2p20V = 2, HLVD_TRIP_POINT_2p40V = 3, HLVD_TRIP_POINT_2p50V = 4, HLVD_TRIP_POINT_2p70V = 5, HLVD_TRIP_POINT_2p80V = 6, HLVD_TRIP_POINT_3p00V = 7, HLVD_TRIP_POINT_3p30V = 8, HLVD_TRIP_POINT_3p50V = 9, HLVD_TRIP_POINT_3p60V = 10, HLVD_TRIP_POINT_3p80V = 11, HLVD_TRIP_POINT_4p00V = 12, HLVD_TRIP_POINT_4p20V = 13, HLVD_TRIP_POINT_4p50V = 14 }
Trip point values for the HLVD driver.
Detailed Description
HLVD Generated Driver API Header File.