3.13 OPA Driver

Overview

The Operational Amplifier (Op Amp) module provides the ability to condition analog input signals. It can be configured to run in High or Low-Power mode, depending on the user specifications.

Features

  • Op-amp is enabled by default.
  • Enabling an op-amp instance configures the corresponding input and output pins.
  • Positive and Negative channel for each op-amp is user configurable.

3.13.1 Module Documentation

3.13.1.1 OPA Driver

Operational Amplifier Driver used for a wide variety of purposes, including signal conditioning and filtering using dsPIC MCUs.

3.13.1.1.1 Module description

Operational Amplifier Driver used for a wide variety of purposes, including signal conditioning and filtering using dsPIC MCUs.

Data structures
  • struct OPA_INTERFACE

    Structure containing the function pointers of OPA driver.

Enumerations
Functions
Variables
  • const struct OPA_INTERFACE OPA1

    Structure object of type OPA_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. OPA can be changed by the user in the OPA user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

3.13.1.1.2 Function Documentation

OPA1_Deinitialize()

void OPA1_Deinitialize (void )

Deinitializes the OPA1 to POR values.

Parameters:
none
Returns:

none  

OPA1_DifferentialInputModeSet()

inline static void OPA1_DifferentialInputModeSet (enum OPA_DIFFERENTIAL_INPUT_MODE input)

This inline function enables/disables Enables output of OPA1 module to ADC.

Parameters:
in input

- selected differential input mode

Returns:

none  

OPA1_Disable()

inline static void OPA1_Disable (void )

This inline function disables OPA1 module.

Parameters:
none
Returns:

none  

OPA1_Enable()

inline static void OPA1_Enable (void )

This inline function enables OPA1 module.

Precondition:

The OPA1_Initialize function should be called for the specified OPA1 driver instance.

Parameters:
none
Returns:

none  

OPA1_HighPowerModeEnable()

inline static void OPA1_HighPowerModeEnable (bool enable)

This inline function enables/disables high power mode of OPA1 module.

Parameters:
in enable

- true, enables High Power Mode

in enable

- false, disables High Power Mode

Returns:

none  

OPA1_Initialize()

void OPA1_Initialize (void )

Initializes the OPA module.

Parameters:
none
Returns:

none  

OPA1_InputMonitorEnable()

inline static void OPA1_InputMonitorEnable (bool enable)

This inline function enables/disables positive input of OPA1 module to ADC.

Parameters:
in enable

- true, enables input Monitor

in enable

- false, disables input Monitor

Returns:

none  

OPA1_OffsetCorrection()

inline static void OPA1_OffsetCorrection (enum OPA_OFFSET_INPUT_TYPE inputType, enum OPA_OFFSET_CORRECTION_VOLTAGE unitVoltage)

This inline function enables/disables Enables output of OPA1 module to ADC.

Parameters:
in inputType

- selected differential input offset register type

in unitVoltage

- selected unit voltage

Returns:

none  

@Note Unit voltage = trim step voltage 3 mV

OPA1_OutputMonitorEnable()

inline static void OPA1_OutputMonitorEnable (bool enable)

This inline function enables/disables Enables output of OPA1 module to ADC.

Parameters:
in enable

- true, enables output Monitor

in enable

- false, disables output Monitor

Returns:

none  

OPA1_UnityGainEnable()

inline static void OPA1_UnityGainEnable (bool enable)

This inline function enables/disables unity gain of OPA1 module.

Parameters:
in enable

- true, enables unity gain

in enable

- false, disables unity gain  

Returns:

none  

3.13.1.1.3 Enumeration Type Documentation

OPA_DIFFERENTIAL_INPUT_MODE

enum OPA_DIFFERENTIAL_INPUT_MODE

This defines Differential input mode enumeration for OPA.

OPA_DIFFERENTIAL_INPUT_NMOS_PMOS_PAIR

Use both NMOS and PMOS differential input pair

OPA_DIFFERENTIAL_INPUT_NMOS_INPUT_PAIR

Turn NMOS differntial input pair ON and turn PMOS differential input pair off

OPA_DIFFERENTIAL_INPUT_PMOS_INPUT_PAIR

Turn PMOS differntial input pair ON and turn NMOS differential input pair off

OPA_DIFFERENTIAL_INPUT_NONE

No differential input pair selected

OPA_OFFSET_CORRECTION_VOLTAGE

enum OPA_OFFSET_CORRECTION_VOLTAGE

This defines offset correction unit voltage enumeration for OPA @Note Unit voltage = trim step voltage 3 mV.

POSITIVE_15_UNIT_VOLTAGE

Correct offset by +15 unit voltage

POSITIVE_14_UNIT_VOLTAGE

Correct offset by +14 unit voltage

POSITIVE_13_UNIT_VOLTAGE

Correct offset by +13 unit voltage

POSITIVE_12_UNIT_VOLTAGE

Correct offset by +12 unit voltage

POSITIVE_11_UNIT_VOLTAGE

Correct offset by +11 unit voltage

POSITIVE_10_UNIT_VOLTAGE

Correct offset by +10 unit voltage

POSITIVE_9_UNIT_VOLTAGE

Correct offset by +9 unit voltage

POSITIVE_8_UNIT_VOLTAGE

Correct offset by +8 unit voltage

POSITIVE_7_UNIT_VOLTAGE

Correct offset by +7 unit voltage

POSITIVE_6_UNIT_VOLTAGE

Correct offset by +6 unit voltage

POSITIVE_5_UNIT_VOLTAGE

Correct offset by +5 unit voltage

POSITIVE_4_UNIT_VOLTAGE

Correct offset by +4 unit voltage

POSITIVE_3_UNIT_VOLTAGE

Correct offset by +3 unit voltage

POSITIVE_2_UNIT_VOLTAGE

Correct offset by +2 unit voltage

POSITIVE_1_UNIT_VOLTAGE

Correct offset by +1 unit voltage

NONE

Correct offset by 0 unit voltage

NEGATIVE_1_UNIT_VOLTAGE

Correct offset by -1 unit voltage

NEGATIVE_2_UNIT_VOLTAGE

Correct offset by -2 unit voltage

NEGATIVE_3_UNIT_VOLTAGE

Correct offset by -3 unit voltage

NEGATIVE_4_UNIT_VOLTAGE

Correct offset by -4 unit voltage

NEGATIVE_5_UNIT_VOLTAGE

Correct offset by -5 unit voltage

NEGATIVE_6_UNIT_VOLTAGE

Correct offset by -6 unit voltage

NEGATIVE_7_UNIT_VOLTAGE

Correct offset by -7 unit voltage

NEGATIVE_8_UNIT_VOLTAGE

Correct offset by -8 unit voltage

NEGATIVE_9_UNIT_VOLTAGE

Correct offset by -9 unit voltage

NEGATIVE_10_UNIT_VOLTAGE

Correct offset by -10 unit voltage

NEGATIVE_11_UNIT_VOLTAGE

Correct offset by -11 unit voltage

NEGATIVE_12_UNIT_VOLTAGE

Correct offset by -12 unit voltage

NEGATIVE_13_UNIT_VOLTAGE

Correct offset by -13 unit voltage

NEGATIVE_14_UNIT_VOLTAGE

Correct offset by -14 unit voltage

NEGATIVE_15_UNIT_VOLTAGE

Correct offset by -15 unit voltage

NEGATIVE_16_UNIT_VOLTAGE

Correct offset by -16 unit voltage

OPA_OFFSET_INPUT_TYPE

enum OPA_OFFSET_INPUT_TYPE

This defines offset input type enumeration for OPA.

OPA_PMOS_OFFSET_IN_HIGH_POWER_MODE

Offset Correction for PMOS Differential Input Pair (High-Power mode)

OPA_NMOS_OFFSET_IN_HIGH_POWER_MODE

Offset Correction for NMOS Differential Input Pair (High-Power mode)

OPA_PMOS_OFFSET_IN_LOW_POWER_MODE

Offset Correction for PMOS Differential Input Pair (Low-Power mode)

OPA_NMOS_OFFSET_IN_LOW_POWER_MODE

Offset Correction for NMOS Differential Input Pair (Low-Power mode)

3.13.1.1.4 Variable Documentation

OPA1

const struct OPA_INTERFACE OPA1

Structure object of type OPA_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. OPA can be changed by the user in the OPA user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

3.13.2 Data Structure Documentation

3.13.2.1 OPA_INTERFACE Struct Reference

Structure containing the function pointers of OPA driver.

3.13.2.1.1 Detailed Description

Structure containing the function pointers of OPA driver.

#include <opa_interface.h>

Data Fields

3.13.2.1.2 Field Documentation

The documentation for this struct was generated from the following file:

source/

opa_interface.h

Deintitialize

void(* Deintitialize) (void)

Pointer to OPAx_Deinitialize e.g. OPA1_Deinitialize.

DifferentialInputModeSet

void(* DifferentialInputModeSet) (enum OPA_DIFFERENTIAL_INPUT_MODE input)

Pointer to OPAx_DifferentialInputModeSet e.g. OPA1_DifferentialInputModeSet.

Disable

void(* Disable) (void)

Pointer to OPAx_Disable e.g. OPA1_Disable.

Enable

void(* Enable) (void)

Pointer to OPAx_Enable e.g. OPA1_Enable.

HighPowerModeEnable

void(* HighPowerModeEnable) (bool enable)

Pointer to OPAx_HighPowerModeEnable e.g. OPA1_HighPowerModeEnable.

InputMonitorEnable

void(* InputMonitorEnable) (bool enable)

Pointer to OPAx_InputMonitorEnable e.g. OPA1_InputMonitorEnable.

Intitialize

void(* Intitialize) (void)

Pointer to OPAx_Initialize e.g. OPA1_Initialize.

OffsetCorrection

void(* OffsetCorrection) (enum OPA_OFFSET_INPUT_TYPE inputType, enum OPA_OFFSET_CORRECTION_VOLTAGE unitVoltage)

Pointer to OPAx_OffsetCorrection e.g. OPA1_OffsetCorrection.

OutputMonitorEnable

void(* OutputMonitorEnable) (bool enable)

Pointer to OPAx_OutputMonitorEnable e.g. OPA1_OutputMonitorEnable.

UnityGainEnable

void(* UnityGainEnable) (bool enable)

Pointer to OPAx_UnityGainEnable e.g. OPA1_UnityGainEnable.

3.13.3 File Documentation

3.13.3.1 source/opa1.h File Reference

This is the generated driver header file for the OPA1 driver.

#include <xc.h>
#include <stdint.h>
#include "opa_interface.h"

3.13.3.1.1 Functions

3.13.3.1.2 Variables

  • const struct OPA_INTERFACE OPA1

    Structure object of type OPA_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. OPA can be changed by the user in the OPA user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

3.13.3.1.3 Detailed Description

This is the generated driver header file for the OPA1 driver.

OPA1 Generated Driver Header File

Version:

PLIB Version 1.0.0-rc.1

3.13.3.2 source/opa_interface.h File Reference

#include <stdbool.h>
#include "opa_types.h"

3.13.3.2.1 Data structures

  • struct OPA_INTERFACE

    Structure containing the function pointers of OPA driver.

3.13.3.2.2 Detailed Description

OPA Generated Driver Interface Header File

3.13.3.3 source/opa_types.h File Reference

This is the generated driver interface header file for the OPA driver.

3.13.3.3.1 Enumerations

3.13.3.3.2 Detailed Description

This is the generated driver interface header file for the OPA driver.

OPA Generated Driver Interface Header File