TcTimerSetEvent
This function starts a specified timer event. The TwinCAT Timer runs in its own thread. After the event is activated, it sets or pulses the specified event object.
DWORD TcTimerSetEvent(
UINT uDelay,
LPTSTR lpEventName,
UINT fuEvent
);
Parameters
uDelay
Event delay, in TcTimer Ticks.
lpEventName
Pointer to a null-terminated string that specifies the name of the event object. The name is limited to MAX_PATH characters and can contain any character except the backslash path-separator character (\). Name comparison is case sensitive. (Note: Event Names starting with "TC_ "are reserved for Beckhoff)
fuEvent
Timer Event Type. Following Table shows the values that can be included by the fuEvent parameter.
Value | Description |
---|---|
TIME_ONESHOT | Event occurs once after uDelay ticks |
TIME_PERIODIC | Event occurs after every uDelay ticks |
TIME_CALLBACK_EVENT_SET | When the timer expires, the system calls the SetEvent() function to set the event with lpEventName. |
TIME_CALLBACK_EVENT_PULSE | When the timer expires, the system calls the PulseEvent() function to pulse the event with lpEventName. |
Return Values
Returns an identifier for the timer event if successful. This function returns NULL if it fails and the timer event was not created.
Remarks
Each call to TcTimerSetEvent for periodic timer events requires a corresponding call to the TcTimerKillEvent function.
The TcTimer Ticks are always configured by the "TwinCAT System Service". This can be done by configuring the "Base Ticks" in the Real Time Settings from the "TwinCAT System Manager" and activating the configuration on the Target System.
QuickInfo
For Windows CE:
- Windows CE Version: Requires version 4.2 or later.
- CE Image Version: Requires version 1.90 or later.
- Header: Declared in TcTimerAPI.h
- Import Library: Use TcTimerWrap.lib