Shop OBEX P1 Docs P2 Docs Learn Events
Clock Cycle Counter for BS2SX? — Parallax Forums

Clock Cycle Counter for BS2SX?

GeorgeCollinsGeorgeCollins Posts: 132
edited 2008-08-17 20:27 in BASIC Stamp
I have been using a BS2SX to control my quadraped robot. Between setting the servo controller for stride positions I 'PAUSE' for a fixed number of mS.

I am trying to make a more robust program, and what I would really like to do is have one program block set the servo positions and use the 'RUN' command to switch to another program block. I would like to keep track of the number CPU clock ticks I spend in that program and come back when a certain amount of time has passed, as measured by the number of clock cycles that have passed.

Many compilers/ languages have some sort of system timer that keeps track of how many clock cycles have passed. I would also like to do this to figure out how many clock cycles have passed when I execute a particular instruction. For example, if I want to replace:
PAUSE 500
with a block of instructions, how do I check to see that the block of instructions takes a roughly equal amount of time? Is there some sort of clock tick counter?

Thanks!
George

Comments

Sign In or Register to comment.