Shop OBEX P1 Docs P2 Docs Learn Events
timer prop? — Parallax Forums

timer prop?

Rob v.d. bergRob v.d. berg Posts: 81
edited 2008-09-08 19:23 in Propeller 1
Hello,

I'm new to the propeller,· the last years·I was busy with·the Javelin.··I have an question about time critical actions.

The·Javelin has a Timer class, you can make·several time·critical actions like:····

private static Timer LogTimer······· = new Timer();

·if (LogTimer.timeout(1000)) {
····LogTimer.mark(); ·

···
····'actions every 1000msec·
·}


I'm looking for this in de propeller environment,· can someone push me in the right·direction.

thanks
Rob.···

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-08 15:02
    The Propeller has a clock register (CNT) that's readable by all the processors and is incremented by the system clock
    (normally 80MHz). Programs can read CNT and the WAITCNT instruction (and the WAITCNT statement in Spin) will
    pause the processor executing it until CNT is equal to a specified value, then continue. Read the sections in the
    Propeller Manual on CNT and WAITCNT for further details.

    Normally, if you want several different time-critical events, you use a separate processor for each one with each one
    waiting on an appropriate WAITCNT. If you want a large number of timed events, you may need to write your own
    scheduler.

    Note that WAITCNT waits for a future absolute time (in clock ticks). That makes it easy to accurately time events
    to the nearest system clock regardless of the time needed to execute the response to the event.

    Post Edited (Mike Green) : 9/8/2008 3:10:25 PM GMT
  • Rob v.d. bergRob v.d. berg Posts: 81
    edited 2008-09-08 19:23
    Mike,

    Thanks for your reaction,·I will start with that.

    Rob.



    ·
Sign In or Register to comment.