Shop OBEX P1 Docs P2 Docs Learn Events
Elapsed clock cycles — Parallax Forums

Elapsed clock cycles

Nico SNico S Posts: 9
edited 2009-10-31 12:17 in BASIC Stamp
Hi there,

Is there anyway to measure the time elapsed between statements ?
Something like CNT on the propeller chip ?

TIA
Best regards,
Nico Schoemaker

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-30 20:01
    No

    Typically the way this sort of thing is measured is by isolating the statement of interest and putting it in a loop that executes it a specific number of times (like 1000), preceding and following the loop with a PULSOUT statement and measuring the elapsed time using some kind of external timer. By using a large loop, the fixed overhead of the loop and the PULSOUT statements becomes a small part of the overall time. You can also remove the statement of interest from the loop and remeasure the total time, then subtract that from the measurement with the statement of interest in place.
  • Nico SNico S Posts: 9
    edited 2009-10-30 20:18
    Hi Mike,

    Thanks a lot for your reply.
    I was trying to get rid of the PAUSE commands, used for example in controling a servo(s), to free up some processing time.
    Anyway thanks again.

    Best regards,
    Nico Schoemaker
  • ercoerco Posts: 20,256
    edited 2009-10-30 20:26
    Have·a look at Tracy Allen's great info at http://www.emesys.com/BS2speed.htm to estimate command execution speeds.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Nico SNico S Posts: 9
    edited 2009-10-31 12:17
    Hi erco,

    Thanks for the URL, indeed great info !!
Sign In or Register to comment.