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-K4xPIC18F-K83PIC18F-Q10
PIC18F-Q2xPIC18F-Q4xPIC18F-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.

Version: HLVD Driver Version 2.11.0
Functions

Function Documentation

HLVD_CallbackRegister()

void HLVD_CallbackRegister (void(*)(void) CallbackHandler)

Sets the callback handler for the HLVD interrupt events.

Parameters:
(*CallbackHandler)(void)

- Function pointer to the HLVD interrupt handler.

Returns:

None.

HLVD_Enable()

void HLVD_Enable (void )

Enables the HLVD.

Parameters:
None.
Returns:

None.

HLVD_Initialize()

void HLVD_Initialize (void )

Initializes the HLVD module. This is called only once before calling other HLVD APIs.

Section: HLVD APIs

Parameters:
None.
Returns:

None.

Section: HLVD Module APIs

HLVD_IsBandGapVoltageStable()

bool HLVD_IsBandGapVoltageStable (void )

Returns the status of the band gap reference voltage.

Precondition:

HLVD_Initialize() is already called.

Parameters:
None.
Return values:
True

- Band gap voltage is stable.

False

- Band gap voltage is unstable.

HLVD_OutputStatusGet()

bool HLVD_OutputStatusGet (void )

Returns the HLVD comparator output status.

Parameters:
None.
Return values:
True

- Voltage is lower than the selected trip point.

False

- Voltage is higher than the selected trip point.

HLVD_Tasks()

void HLVD_Tasks (void )

Checks the status of the HLVD Interrupt Flag bit.

Parameters:
None.
Returns:

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.

Parameters:
Negative_Trip

- Negative going (Low-Voltage) interrupt is enabled (1) or disabled (0).

Positive_Trip

- Positive going (High-Voltage) interrupt is enabled (1) or disabled (0).

trip_points

- Trip point value.

Returns:

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

Detailed Description

This file contains the API implementation for the HLVD driver.

HLVD Generated Driver File.

Version: HLVD Driver Version 2.11.0

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

Detailed Description

HLVD Generated Driver API Header File.