on timer
Valid for: CANoe DE • CANoe:lite DE • CANoe4SW DE • CANoe4SW:lite DE You can define time events in CAPL. When this event occurs, i.e. when a certain period of time elapses, the associatedon timer procedure is called. You can program cyclic program sequences by resetting the same time event within the on timer procedure.
The timer variable can be accessed with the key word this within the event procedure.
You would start a previously-defined timer with the function setTimer.
In CAPL exists the following variable types for timer:
- timer - timer based on seconds
- msTimer - timer based on milliseconds
on timer procedure is called. The maximum time is 2147483647 s (=596523.23h) for variables of the type timer and 2147483647 ms (= 2147483,647 s = 596,52h) for variables of the type msTimer. With the function cancelTimer you can stop a timer which has already been started and thereby prevent the associated on timer procedure from being called.
Note
If several CAPL timers elapse to the exact same time:
- all timers will be executed
- the event procedures of these timers will be operated in an undefined sequence
Version Extensions
Since version 7.2, you can retrieve the name of the timer as a string constant withthis.name.
Since version 7.5 you can save timers in an array.
Example