'How can we get a exact out put using capl

Write capl program to set 100ms timer and apply the below conditions. Read the value from 1 to 10 disable the timer and again start the timer using any conditions??



Solution 1:[1]

looks like you need to get into CANoe timers. In your variables section, define a mstimer mytimer; or something with a speaking name. in on start you can then use the function setTimer to set the timer once, but then, you have to setTimer again within the event handler of the timer (see below). If you use setTimerCyclic instead, the timer will be called cyclically, if this is what you require.

Then, as an event handler use on timer mytimer and add your code there. If you need multiple timers, add additional timers and they can trigger each other.

Use cancelTimer to abort a timer before the event handler is triggered.

Hope, that helped you further. There should also be an example in the help of the CAPL browser, explaining those functions and showing them in context.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MaPr