MSP430 DriverLib for MSP430F5xx_6xx Devices  2.80.00.01
 All Data Structures Functions Variables Modules Pages
comp_b

Functions

bool Comp_B_init (uint16_t baseAddress, Comp_B_initParam *param)
 Initializes the Comp_B Module. More...
 
void Comp_B_configureReferenceVoltage (uint16_t baseAddress, Comp_B_configureReferenceVoltageParam *param)
 Generates a Reference Voltage to the terminal selected during initialization. More...
 
void Comp_B_enableInterrupt (uint16_t baseAddress, uint16_t interruptMask)
 Enables selected Comp_B interrupt sources. More...
 
void Comp_B_disableInterrupt (uint16_t baseAddress, uint16_t interruptMask)
 Disables selected Comp_B interrupt sources. More...
 
void Comp_B_clearInterrupt (uint16_t baseAddress, uint16_t interruptFlagMask)
 Clears Comp_B interrupt flags. More...
 
uint8_t Comp_B_getInterruptStatus (uint16_t baseAddress, uint16_t interruptFlagMask)
 Gets the current Comp_B interrupt status. More...
 
void Comp_B_setInterruptEdgeDirection (uint16_t baseAddress, uint16_t edgeDirection)
 Explicitly sets the edge direction that would trigger an interrupt. More...
 
void Comp_B_toggleInterruptEdgeDirection (uint16_t baseAddress)
 Toggles the edge direction that would trigger an interrupt. More...
 
void Comp_B_enable (uint16_t baseAddress)
 Turns on the Comp_B module. More...
 
void Comp_B_disable (uint16_t baseAddress)
 Turns off the Comp_B module. More...
 
void Comp_B_shortInputs (uint16_t baseAddress)
 Shorts the two input pins chosen during initialization. More...
 
void Comp_B_unshortInputs (uint16_t baseAddress)
 Disables the short of the two input pins chosen during initialization. More...
 
void Comp_B_disableInputBuffer (uint16_t baseAddress, uint8_t inputPort)
 Disables the input buffer of the selected input port to effectively allow for analog signals. More...
 
void Comp_B_enableInputBuffer (uint16_t baseAddress, uint8_t inputPort)
 Enables the input buffer of the selected input port to allow for digital signals. More...
 
void Comp_B_swapIO (uint16_t baseAddress)
 Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the Comp_B. More...
 
uint16_t Comp_B_outputValue (uint16_t baseAddress)
 Returns the output value of the Comp_B module. More...
 

Detailed Description

Function Documentation

void Comp_B_clearInterrupt ( uint16_t  baseAddress,
uint16_t  interruptFlagMask 
)

Clears Comp_B interrupt flags.

The Comp_B interrupt source is cleared, so that it no longer asserts. The highest interrupt flag is automatically cleared when an interrupt vector generator is used.

Parameters
baseAddressis the base address of the COMP_B module.
interruptFlagMaskis a bit mask of the interrupt sources to be cleared. Mask value is the logical OR of any of the following:
  • COMP_B_OUTPUT_FLAG - Output interrupt
  • COMP_B_OUTPUTINVERTED_FLAG - Output interrupt inverted polarity
    Modified bits of CBINT register.
Returns
None
void Comp_B_configureReferenceVoltage ( uint16_t  baseAddress,
Comp_B_configureReferenceVoltageParam param 
)

Generates a Reference Voltage to the terminal selected during initialization.

Use this function to generate a voltage to serve as a reference to the terminal selected at initialization. The voltage is determined by the equation: Vbase * (Numerator / 32). If the upper and lower limit voltage numerators are equal, then a static reference is defined, whereas they are different then a hysteresis effect is generated.

Parameters
baseAddressis the base address of the COMP_B module.
paramis the pointer to struct for reference voltage configuration.
Returns
None

References Comp_B_configureReferenceVoltageParam::lowerLimitSupplyVoltageFractionOf32, Comp_B_configureReferenceVoltageParam::referenceAccuracy, Comp_B_configureReferenceVoltageParam::supplyVoltageReferenceBase, and Comp_B_configureReferenceVoltageParam::upperLimitSupplyVoltageFractionOf32.

void Comp_B_disable ( uint16_t  baseAddress)

Turns off the Comp_B module.

This function clears the CBON bit disabling the operation of the Comp_B module, saving from excess power consumption.

Parameters
baseAddressis the base address of the COMP_B module.
Returns
None
void Comp_B_disableInputBuffer ( uint16_t  baseAddress,
uint8_t  inputPort 
)

Disables the input buffer of the selected input port to effectively allow for analog signals.

This function sets the bit to disable the buffer for the specified input port to allow for analog signals from any of the Comp_B input pins. This bit is automatically set when the input is initialized to be used with the Comp_B module. This function should be used whenever an analog input is connected to one of these pins to prevent parasitic voltage from causing unexpected results.

Parameters
baseAddressis the base address of the COMP_B module.
inputPortis the port in which the input buffer will be disabled. Valid values are:
  • COMP_B_INPUT0 [Default]
  • COMP_B_INPUT1
  • COMP_B_INPUT2
  • COMP_B_INPUT3
  • COMP_B_INPUT4
  • COMP_B_INPUT5
  • COMP_B_INPUT6
  • COMP_B_INPUT7
  • COMP_B_INPUT8
  • COMP_B_INPUT9
  • COMP_B_INPUT10
  • COMP_B_INPUT11
  • COMP_B_INPUT12
  • COMP_B_INPUT13
  • COMP_B_INPUT14
  • COMP_B_INPUT15
  • COMP_B_VREF
    Modified bits are CBPDx of CBCTL3 register.
Returns
None
void Comp_B_disableInterrupt ( uint16_t  baseAddress,
uint16_t  interruptMask 
)

Disables selected Comp_B interrupt sources.

Disables the indicated Comp_B interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
baseAddressis the base address of the COMP_B module.
interruptMaskis the bit mask of the interrupt sources to be disabled. Mask value is the logical OR of any of the following:
  • COMP_B_OUTPUT_INT - Output interrupt
  • COMP_B_OUTPUTINVERTED_INT - Output interrupt inverted polarity
    Modified bits of CBINT register.
Returns
None
void Comp_B_enable ( uint16_t  baseAddress)

Turns on the Comp_B module.

This function sets the bit that enables the operation of the Comp_B module.

Parameters
baseAddressis the base address of the COMP_B module.
Returns
None
void Comp_B_enableInputBuffer ( uint16_t  baseAddress,
uint8_t  inputPort 
)

Enables the input buffer of the selected input port to allow for digital signals.

This function clears the bit to enable the buffer for the specified input port to allow for digital signals from any of the Comp_B input pins. This should not be reset if there is an analog signal connected to the specified input pin to prevent from unexpected results.

Parameters
baseAddressis the base address of the COMP_B module.
inputPortis the port in which the input buffer will be enabled. Valid values are:
  • COMP_B_INPUT0 [Default]
  • COMP_B_INPUT1
  • COMP_B_INPUT2
  • COMP_B_INPUT3
  • COMP_B_INPUT4
  • COMP_B_INPUT5
  • COMP_B_INPUT6
  • COMP_B_INPUT7
  • COMP_B_INPUT8
  • COMP_B_INPUT9
  • COMP_B_INPUT10
  • COMP_B_INPUT11
  • COMP_B_INPUT12
  • COMP_B_INPUT13
  • COMP_B_INPUT14
  • COMP_B_INPUT15
  • COMP_B_VREF
    Modified bits are CBPDx of CBCTL3 register.
Returns
None
void Comp_B_enableInterrupt ( uint16_t  baseAddress,
uint16_t  interruptMask 
)

Enables selected Comp_B interrupt sources.

Enables the indicated Comp_B interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. Does not clear interrupt flags.

Parameters
baseAddressis the base address of the COMP_B module.
interruptMaskis the bit mask of the interrupt sources to be enabled. Mask value is the logical OR of any of the following:
  • COMP_B_OUTPUT_INT - Output interrupt
  • COMP_B_OUTPUTINVERTED_INT - Output interrupt inverted polarity
    Modified bits of CBINT register.
Returns
None
uint8_t Comp_B_getInterruptStatus ( uint16_t  baseAddress,
uint16_t  interruptFlagMask 
)

Gets the current Comp_B interrupt status.

This returns the interrupt status for the Comp_B module based on which flag is passed.

Parameters
baseAddressis the base address of the COMP_B module.
interruptFlagMaskis the masked interrupt flag status to be returned. Mask value is the logical OR of any of the following:
  • COMP_B_OUTPUT_FLAG - Output interrupt
  • COMP_B_OUTPUTINVERTED_FLAG - Output interrupt inverted polarity
Returns
Logical OR of any of the following:
  • Comp_B_OUTPUT_FLAG Output interrupt
  • Comp_B_OUTPUTINVERTED_FLAG Output interrupt inverted polarity
    indicating the status of the masked interrupts
bool Comp_B_init ( uint16_t  baseAddress,
Comp_B_initParam param 
)

Initializes the Comp_B Module.

Upon successful initialization of the Comp_B module, this function will have reset all necessary register bits and set the given options in the registers. To actually use the Comp_B module, the Comp_B_enable() function must be explicitly called before use. If a Reference Voltage is set to a terminal, the Voltage should be set using the Comp_B_setReferenceVoltage() function.

Parameters
baseAddressis the base address of the COMP_B module.
paramis the pointer to struct for initialization.
Returns
STATUS_SUCCESS or STATUS_FAILURE of the initialization process.

References Comp_B_initParam::invertedOutputPolarity, Comp_B_initParam::negativeTerminalInput, Comp_B_initParam::outputFilterEnableAndDelayLevel, Comp_B_initParam::positiveTerminalInput, and Comp_B_initParam::powerModeSelect.

uint16_t Comp_B_outputValue ( uint16_t  baseAddress)

Returns the output value of the Comp_B module.

Returns the output value of the Comp_B module.

Parameters
baseAddressis the base address of the COMP_B module.
Returns
One of the following:
  • Comp_B_LOW
  • Comp_B_HIGH
    indicating the output value of the Comp_B module
void Comp_B_setInterruptEdgeDirection ( uint16_t  baseAddress,
uint16_t  edgeDirection 
)

Explicitly sets the edge direction that would trigger an interrupt.

This function will set which direction the output will have to go, whether rising or falling, to generate an interrupt based on a non-inverted interrupt.

Parameters
baseAddressis the base address of the COMP_B module.
edgeDirectiondetermines which direction the edge would have to go to generate an interrupt based on the non-inverted interrupt flag. Valid values are:
  • COMP_B_FALLINGEDGE [Default] - sets the bit to generate an interrupt when the output of the Comp_B falls from HIGH to LOW if the normal interrupt bit is set(and LOW to HIGH if the inverted interrupt enable bit is set).
  • COMP_B_RISINGEDGE - sets the bit to generate an interrupt when the output of the Comp_B rises from LOW to HIGH if the normal interrupt bit is set(and HIGH to LOW if the inverted interrupt enable bit is set).
    Modified bits are CBIES of CBCTL1 register.
Returns
None
void Comp_B_shortInputs ( uint16_t  baseAddress)

Shorts the two input pins chosen during initialization.

This function sets the bit that shorts the devices attached to the input pins chosen from the initialization of the Comp_B.

Parameters
baseAddressis the base address of the COMP_B module.
Returns
None
void Comp_B_swapIO ( uint16_t  baseAddress)

Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the Comp_B.

This function toggles the bit that controls which input goes to which terminal. After initialization, this bit is set to 0, after toggling it once the inputs are routed to the opposite terminal and the output is inverted.

Parameters
baseAddressis the base address of the COMP_B module.
Returns
None
void Comp_B_toggleInterruptEdgeDirection ( uint16_t  baseAddress)

Toggles the edge direction that would trigger an interrupt.

This function will toggle which direction the output will have to go, whether rising or falling, to generate an interrupt based on a non-inverted interrupt. If the direction was rising, it is now falling, if it was falling, it is now rising.

Parameters
baseAddressis the base address of the COMP_B module.
Returns
None
void Comp_B_unshortInputs ( uint16_t  baseAddress)

Disables the short of the two input pins chosen during initialization.

This function clears the bit that shorts the devices attached to the input pins chosen from the initialization of the Comp_B.

Parameters
baseAddressis the base address of the COMP_B module.
Returns
None

Copyright 2016, Texas Instruments Incorporated