Freescale-
AnalogComp
 
Component FreescaleAnalogComp
Analog comparator on Freescale derivates
Component Level: Low
Methods:
(Methods are user-callable functions/subroutines intended for the component functions control. Please see the Embedded Components page for more information.)
  • Enable - This method enables the analog comparator.

      ANSIC prototype: byte Enable(void)
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_SPEED - This device does not work in the active speed mode

  • Disable - This method disables the analog comparator.

      ANSIC prototype: byte Disable(void)
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_SPEED - This device does not work in the active speed mode

  • EnableEvent - This method enables the events. This method is available only if "Interrupt service/event" property is Enabled.

      ANSIC prototype: byte EnableEvent(void)
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_SPEED - This device does not work in the active speed mode

  • DisableEvent - This method disables the events. This method is available only if "Interrupt service/event" property is Enabled.

      ANSIC prototype: byte DisableEvent(void)
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_SPEED - This device does not work in the active speed mode

  • GetAnalogComparatorOutputValue - This method returns current value of the analog comparator output.

      ANSIC prototype: byte GetAnalogComparatorOutputValue(byte *pCmpOutputVal)
    • pCmpOutputVal: Pointer to byte - Pointer to a variable to receive the current analog comparator output value. (Possible analog comparator output values are 0 or 1.)
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_SPEED - This device does not work in the active speed mode
      • ERR_DISABLED - Device is disabled

  • SetAnalogComparatorMode - This method allows you to change the analog comparator mode (edge of analog comparator output to generate interrupt) at runtime.
    Version specific information for Freescale HCS08 and RS08 and ColdFireV1 derivatives
    This method is not available for HSCMP device with "Interrupt service/event" property disabled .

      ANSIC prototype: byte SetAnalogComparatorMode(byte NewAnCmpMode)
    • NewAnCmpMode:byte - New analog comparator mode. The FreescaleAnalogComp component defines the following symbolic constants for use as a parameter:
      • <ComponentName>_RISING_EDGE - select rising edge comparator mode
      • <ComponentName>_FALLING_EDGE - select falling edge comparator mode
      • <ComponentName>_BOTH_EDGES - select rising or falling edge comparator mode
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_SPEED - This device does not work in the active speed mode
      • ERR_RANGE - Parameter out of range

  • Methods only if ACMP supports muxed positive input.
    • SetComparatorPosInput - This method allows you to change the analog comparator positive input at runtime.
      Note: ACMP module have to be disabled for proper function, otherwise the method returns error code ERR_ENABLED.

        ANSIC prototype: byte SetComparatorPosInput(byte PosInpChanNum)
      • PosInpChanNum:byte - Positive input channel number. Channel 0 is defined in the "Positive input" property. Additional channels (1, ...) can be defined in the "Additional positive inputs" property group.
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_SPEED - This device does not work in the active speed mode
        • ERR_RANGE - Parameter out of range
        • ERR_ENABLED - Device is enabled

  • Methods only if ACMP supports muxed negative input.
    • SetComparatorNegInput - This method allows you to change the analog comparator negative input at runtime.
      Note: ACMP module have to be disabled for proper function, otherwise the method returns error code ERR_ENABLED.

        ANSIC prototype: byte SetComparatorNegInput(byte NegInpChanNum)
      • NegInpChanNum:byte - Negative input channel number. Channel 0 is defined in the "Negative input" property. Additional channels (1, ...) can be defined in the "Additional negative inputs" property group.
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_SPEED - This device does not work in the active speed mode
        • ERR_RANGE - Parameter out of range
        • ERR_ENABLED - Device is enabled

  • Methods only if comparator has input from DAC (PRG).
    • SetDACfeatures - Sets the DAC (PRG) feature settings at runtime and enable DAC (PRG) module.

        ANSIC prototype: byte SetDACfeatures(byte DACmode, byte OutputVoltageMultiplier)
      • DACmode:byte - DAC (PRG) mode. The FreescaleAnalogComp component defines the following symbolic constants for use as a parameter:
        • <ComponentName>_DAC_DISABLE - disable DAC (PRG) module
        • <ComponentName>_DAC_VIN1 - enable DAC (PRG) module, use voltage reference Vin1 as the DAC (PRG) input
        • <ComponentName>_DAC_VIN2 - enable DAC (PRG) module, use voltage reference Vin2 as the DAC (PRG) input
      • OutputVoltageMultiplier:byte - Select DAC (PRG) output voltage multiplier, DACOutputVoltage = OutputVoltageMultiplier * Vin/32.
        Posible values are 1..32.
        If value is equal to 32 the full Vin is on DAC (PRG) output.
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_SPEED - This device does not work in the active speed mode
        • ERR_RANGE - Parameter out of range


Note: Some methods can be implemented as macros.