Capture
 
Component Capture
Timer capture encapsulation
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 component - it starts the capture. Events may be generated (DisableEvent/EnableEvent).

      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 component - it stops the capture. No events will be generated.

      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 any event is selected.

      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 any event is selected.

      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

  • Reset - This method resets the counter register (see implementation note in General Info).

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

  • GetCaptureValue - This method gets the last value captured by enabled timer (see implementation note in General Info). The method does not return valid value after initialization or after Reset until new capture event (even if the returned Error code is ERR_OK).

      ANSIC prototype: byte GetCaptureValue(ComponentName_TCapturedValue *Value)
    • Value: Pointer to ComponentName_TCapturedValue - A pointer to the content of the capture register
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_SPEED - This device does not work in the active speed mode

  • Methods only if timer supports second capture register for the same signal (PWT timer)
    • GetCaptureValue2 - This method returns second captured value (on second edge). The method is available only if timer settings supports capture both edges and selected capture edge is both - please refer to datasheet for details.

      The method does not return valid value after initialization or after Reset until new capture event (even if the returned Error code is ERR_OK).


        ANSIC prototype: byte GetCaptureValue2(ComponentName_TCapturedValue *Value)
      • Value: Pointer to ComponentName_TCapturedValue - A pointer to the content of the capture register
      • Return value:byte - Error code, possible codes:
        ERR_OK - OK
        ERR_SPEED - This device does not work in the active speed mode

  • GetStatus - The method returns status of input capture event and resets it if new capture event has occurred.
    This method is available only if the Interrupt service/event property is disabled.

      ANSIC prototype: bool GetStatus(void)
    • Return value:bool -
      true - new capture event occurred, value was captured
      false - no capture event occurred

  • Method for Freescale HC08, HCS08 and ColdFireV1 derivatives only.
    • GetPinValue - The method reads the Capture pin value. The method is available only if it is possible to read the pin value (usually not available for internal signals).

        ANSIC prototype: bool GetPinValue(void)
      • Return value:bool - Capture pin value.
        true - high level
        false - low level.


Note: Some methods can be implemented as macros.