FreeCntr
 
Component FreeCntr
Time measurement based on counter value (suitable for short time periods)
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, i.e. timer is enabled and the internal clocks are counted. The method usually also reset the counter (if it is supported by HW).
    The method is not available if the counter is shared.

      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, i.e. timer is disabled and the internal clocks are stopped. Last counter value is usually preserved in the counter (if it is supported by HW).
    The method is not available if the counter is shared.

      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. The method is available only if an event 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. The method is available only if an event 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

  • Reset - This method resets the timer-counter (sets to zero for up-counting HW or to appropriate value for down-counting HW). The method is available only if the counter register can be set by software and the counter is not shared.

      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

  • GetCounterValue - This method returns a content of the counter.

      ANSIC prototype: byte GetCounterValue(ComponentName_TTimerValue *Value)
    • Value: Pointer to ComponentName_TTimerValue - Pointer to returned value.
    • Return value:byte - Error code, possible codes:
      ERR_OK - OK
      ERR_SPEED - This device does not work in the active speed mode

  • SetCompare - This method sets the appropriate compare/modulo/reload register. The method is available only when compare, modulo or reload register is selected in the Device property.

    Note:This is low level method, value written using this method is discarded when changing active speed-mode.


      ANSIC prototype: void SetCompare(ComponentName_TTimerValue Value)
    • Value:ComponentName_TTimerValue - This value is stored to compare register.
      Version specific information for HCS08 and ColdFireV1 derivatives for peripheral TOD:
      Only 6 higher bits of the parameter are valid and can be set to the match register (2 LSB bits are ignored). Please refer to datasheets for details.

  • GetStatus - This method gets appropriate interrupt flag, that indicates event from selected timer Device. If the flag is set, the method clears it.
    The method is available only if the Interrupt service/events property is disabled. (Otherwise the flag is cleared in interrupt service routine.)

      ANSIC prototype: bool GetStatus(void)
    • Return value:bool - Status flag (true if flag is set, false otherwise)


Note: Some methods can be implemented as macros.