4.19.4 5.5 MHz Gain Bandwidth OPAMP with Hardware Peak Detect

5.5 MHz Gain Bandwidth Operational Amplifier with Hardware Peak Detect

4.19.4.1 Introduction

The Operational Amplifier (OPA) module features a standard general purpose three-terminal device with programmable gain options, adjustable input offset voltage and hardware override control capabilities. This variant of the module features a 5.5 MHz Gain Bandwidth that can be configured as peak or trough detector by connecting an external capacitor to the module’s output pin.

4.19.4.2 Supported Device Families

PIC18F-Q71

4.19.4.3 Required header files

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

4.19.4.4 Module Documentation

4.19.4.4.1 OPA1

This is the implementation file for the OPA1 driver.

Module description

This is the implementation file for the OPA1 driver.

Version: OPA1 Driver Version 1.0.0
Definitions
Enumerations
Functions

Definition Documentation

OPA1_DisableChargePump

#define OPA1_DisableChargePump OPA1_DisableChargePump

Defines the Custom Name for the OPA1_DisableChargePump API.

OPA1_DisableHardwareOverride

#define OPA1_DisableHardwareOverride OPA1_DisableHardwareOverride

Defines the Custom Name for the OPA1_DisableHardwareOverride API.

OPA1_DisableSoftwareUnityGain

#define OPA1_DisableSoftwareUnityGain OPA1_DisableSoftwareUnityGain

Defines the Custom Name for the OPA1_DisableSoftwareUnityGain API.

OPA1_EnableChargePump

#define OPA1_EnableChargePump OPA1_EnableChargePump

Defines the Custom Name for the OPA1_EnableChargePump API.

OPA1_EnableHardwareOverride

#define OPA1_EnableHardwareOverride OPA1_EnableHardwareOverride

Defines the Custom Name for the OPA1_EnableHardwareOverride API.

OPA1_EnableSoftwareUnityGain

#define OPA1_EnableSoftwareUnityGain OPA1_EnableSoftwareUnityGain

Defines the Custom Name for the OPA1_EnableSoftwareUnityGain API.

OPA1_Initialize

#define OPA1_Initialize OPA1_Initialize

Defines the Custom Name for the OPA1_Initialize API.

OPA1_isAutomaticOffsetCalibrationDone

#define OPA1_isAutomaticOffsetCalibrationDone OPA1_isAutomaticOffsetCalibrationDone

Defines the Custom Name for the OPA1_isAutomaticOffsetCalibrationDone API.

OPA1_ManualInputOffsetCalibration

#define OPA1_ManualInputOffsetCalibration OPA1_ManualInputOffsetCalibration

Defines the Custom Name for the OPA1_ManualInputOffsetCalibration API.

OPA1_SetHardwareOverrideSource

#define OPA1_SetHardwareOverrideSource OPA1_SetHardwareOverrideSource

Defines the Custom Name for the OPA1_SetHardwareOverrideSource API.

OPA1_SetNegativeChannel

#define OPA1_SetNegativeChannel OPA1_SetNegativeChannel

Defines the Custom Name for the OPA1_SetNegativeChannel API.

OPA1_SetNegativeSource

#define OPA1_SetNegativeSource OPA1_SetNegativeSource

Defines the Custom Name for the OPA1_SetNegativeSource API.

OPA1_SetPositiveChannel

#define OPA1_SetPositiveChannel OPA1_SetPositiveChannel

Defines the Custom Name for the OPA1_SetPositiveChannel API.

OPA1_SetPositiveSource

#define OPA1_SetPositiveSource OPA1_SetPositiveSource

Defines the Custom Name for the OPA1_SetPositiveSource API.

OPA1_SetResistorLadder

#define OPA1_SetResistorLadder OPA1_SetResistorLadder

Defines the Custom Name for the OPA1_SetResistorLadder API.

OPA1_StartAutomaticOffsetCalibration

#define OPA1_StartAutomaticOffsetCalibration OPA1_StartAutomaticOffsetCalibration

Defines the Custom Name for the OPA1_StartAutomaticOffsetCalibration API.

OPA1_StartPeakTroughReset

#define OPA1_StartPeakTroughReset OPA1_StartPeakTroughReset

Defines the Custom Name for the OPA1_StartPeakTroughReset API.

OPA1_StopPeakTroughReset

#define OPA1_StopPeakTroughReset OPA1_StopPeakTroughReset

Defines the Custom Name for the OPA1_StopPeakTroughReset API.

Function Documentation

OPA1_DisableChargePump()

void OPA1_DisableChargePump (void )[inline]

Disables the OPA1 Charge Pump bit.

Parameters:
None.
Returns:

None.

OPA1_DisableHardwareOverride()

void OPA1_DisableHardwareOverride (void )[inline]

Disables the hardware override by clearing the Override Enable bit.

Parameters:
None.
Returns:

None.

OPA1_DisableSoftwareUnityGain()

void OPA1_DisableSoftwareUnityGain (void )[inline]

Disables Unity Gain mode in OPA1.

Parameters:
None.
Returns:

None.

OPA1_EnableChargePump()

void OPA1_EnableChargePump (void )[inline]

Enables the OPA1 Charge Pump bit.

Precondition:

Initialize opa1 with OPA1_Initialize() before calling this API.

Parameters:
None.
Returns:

None.

OPA1_EnableHardwareOverride()

void OPA1_EnableHardwareOverride (void )[inline]

Enables hardware override by setting the Override Enable bit.

Parameters:
None.
Returns:

None.

OPA1_EnableSoftwareUnityGain()

void OPA1_EnableSoftwareUnityGain (void )[inline]

Enables OPA1 to operate with Unity Gain mode.

Parameters:
None.
Returns:

None.

OPA1_Initialize()

void OPA1_Initialize (void )

Initializes the OPA1 module. This routine is called only once during system initialization, before calling other APIs.

Parameters:
None.
Returns:

None.

Section: Included Files Section: OPA1 Module APIs

OPA1_isAutomaticOffsetCalibrationDone()

bool OPA1_isAutomaticOffsetCalibrationDone (void )[inline]

Checks if the automatic input offset calibration has been completed.

Precondition:

The OPA1_StartAutomaticOffsetCalibration() routine must be called before this routine

Parameters:
None.
Returns:

true or false

OPA1_ManualInputOffsetCalibration()

void OPA1_ManualInputOffsetCalibration (uint8_t offset)[inline]

Sets the input offset calibration.

Parameters:
Desired

input offset based on calibration

Returns:

None.

OPA1_SetHardwareOverrideSource()

void OPA1_SetHardwareOverrideSource (uint8_t overrideSource, uint8_t polarity)

Selects the Hardware Override Source and polarity.

Precondition:

The OPA1_EnableHardwareOverride() routine must be called before this routine

Parameters:
Desired

hardware override source and source polarity

Returns:

None.

OPA1_SetNegativeChannel()

void OPA1_SetNegativeChannel (OPA1_negChannel_select negChannel)[inline]

Sets the negative channel as per user selection.

Parameters:
Desired

negative channel. Refer to the OPA1_negChannel_select enum from the opa1.h file for the available negative channels.

Returns:

None.

OPA1_SetNegativeSource()

void OPA1_SetNegativeSource (OPA1_negSource_select negSource)[inline]

Sets the negative source as per user selection.

Parameters:
Desired

negative source. Refer to the OPA1_negSource_select enum from the opa1.h file for the available negative sources.

Returns:

None.

OPA1_SetPositiveChannel()

void OPA1_SetPositiveChannel (OPA1_posChannel_select posChannel)[inline]

Sets the positive channel as per user selection.

Parameters:
Desired

positive channel. Refer to the OPA1_posChannel_select enum from the opa1.h file for the available positive channels.

Returns:

None.

OPA1_SetPositiveSource()

void OPA1_SetPositiveSource (OPA1_posSource_select posSource)[inline]

Sets the positive source as per user selection.

Parameters:
Desired

positive source. Refer to the OPA1_posSource_select enum from the opa1.h file for the available positive sources.

Returns:

None.

OPA1_SetResistorLadder()

void OPA1_SetResistorLadder (OPA1_resistor_select resistorSelection)

Sets the R1 and R2 values of internal resistor ladder as per user selection.

Parameters:
Desired

resistor selection. Refer to the OPA1_resistor_sel enum from the opa1.h file for the available resistor values.

Returns:

None.

OPA1_StartAutomaticOffsetCalibration()

void OPA1_StartAutomaticOffsetCalibration (void )

Starts the automatic input offset calibration.

Parameters:
None.
Returns:

None.

OPA1_StartPeakTroughReset()

void OPA1_StartPeakTroughReset (void )[inline]

Initiates a peak or through Reset.

Precondition:

Set the hardware control configuration registers with the correct values.

Parameters:
None.
Returns:

None.

OPA1_StopPeakTroughReset()

void OPA1_StopPeakTroughReset (void )[inline]

Stop peak or through Reset.

Precondition:

Set the hardware control configuration registers with the correct values.

Parameters:
None.
Returns:

None.

Enumeration Type Documentation

OPA1_negChannel_select

enum OPA1_negChannel_select

Enumeration of the available negative channels.

OPA1_negChannel_No_Connection
OPA1_negChannel_GSEL
OPA1_negChannel_OPA1IN
OPA1_negChannel_DAC1
OPA1_negChannel_DAC2
OPA1_negChannel_DAC3
OPA1_negSource_select

enum OPA1_negSource_select

Enumeration of the available negative sources.

OPA1_RA2_IN0_neg
OPA1_RA4_IN1_neg
OPA1_RA5_IN2_neg
OPA1_RB1_IN3_neg
OPA1_Vss
OPA1_posChannel_select

enum OPA1_posChannel_select

Enumeration of the available positive channels.

OPA1_posChannel_Vss
OPA1_posChannel_GSEL
OPA1_posChannel_OPA1IN
OPA1_posChannel_Vdd_by_2
OPA1_posChannel_DAC1
OPA1_posChannel_DAC2
OPA1_posChannel_DAC3
OPA1_posSource_select

enum OPA1_posSource_select

Enumeration of the available positive sources.

OPA1_RA2_IN0_pos
OPA1_RA4_IN1_pos
OPA1_RA5_IN2_pos
OPA1_RB1_IN3_pos
OPA1_resistor_select

enum OPA1_resistor_select

Enumeration of the R2/R1 resistor ratio.

OPA1_R2byR1_is_0dp07

R2/R1 = 0.07

OPA1_R2byR1_is_0dp14

R2/R1 = 0.14

OPA1_R2byR1_is_0dp33

R2/R1 = 0.33

OPA1_R2byR1_is_1

R2/R1 = 1

OPA1_R2byR1_is_1dp67

R2/R1 = 1.67

OPA1_R2byR1_is_3

R2/R1 = 3

OPA1_R2byR1_is_7

R2/R1 = 7

OPA1_R2byR1_is_15

R2/R1 = 15

4.19.4.5 File Documentation

4.19.4.5.1 source/opa1.c File Reference

This is the implementation file for the OPA1 driver.

#include <xc.h>
#include "../opa1.h"

Functions

Detailed Description

This is the implementation file for the OPA1 driver.

OPA1 Generated Driver File

Version: OPA1 Driver Version 1.0.0

4.19.4.5.2 source/opa1.h File Reference

#include <stdint.h>
#include <stdbool.h>

Functions

Macros

Enumerations

Detailed Description

OPA1 Generated Driver API Header File