How to create a timer event?

Options
Levie
Levie
edited May 2019 in RAPID Programming
Hello!
How can I create a timer event?

The task is as:
1. Start the timer
(5 s, for example, the time changes every iteration).
2. Do something (it is known that it takes less than 5 s, but how much is unknown exactly).
3. Still wait until the time runs out.
4. Do something.





Comments

  • lemster68
    lemster68 ✭✭✭
    Options
    Read up on ITmer interrupt in the rapid instruction manual.
    Lee Justice
  • soup
    soup ✭✭✭
    Options
    I think I've done something similar using PulseDO and WaitDO.

    PulseDO \PLength:=5.0, doMove001;

    MoveL Move001, bla, bla;

    WaitDO doMove001, 0;

    PulseDO \PLength:=5.0, doMove002;

    MoveL Move002, bla, bla;

    WaitDO doMove002, 0;

    PulseDO \PLength:=5.0, doMove003;

    MoveL Move003, bla, bla;

    WaitDO doMove003, 0;

  • lemster68
    lemster68 ✭✭✭
    Options
    @Soup I would make sure to use the optional argument \High to avoid getting into a catastrophe if the signal were on already for some reason.  But that is an interesting implementation.
    Lee Justice
  • soup
    soup ✭✭✭
    Options
    @lemster68 Good point, could also do a SetDO to 0 before the pulse to make sure it goes low.