|
Re: Programing help...
Posted by Quentin Lewis.
Engineer on team #42, P.A.R.T.S - Prececision Alvirne Robotics Technology Systems, from Alvirne, Hudson NH.
Posted on 1/22/2000 6:27 PM MST
In Reply to: Programing help... posted by Adam Anderson on 1/22/2000 2:07 PM MST:
> I am a student programer, and i am looking for a way to do a timer in
> the stamp to fire a motor for a certian amount of time, but i am at a
> loss of a way to do this, i thought i would create a counter that counts
> the cycles of the program, but i can not find out how many
> cycles per second that the controlers CPU can do... anyone have any
> info on this method or any other methods that could accomplish this task..
Well, you could toggle an output every time through the loop and measure it with a scope....and therby GROCK the time to go through the loop.
If you don;t have a scope, you could set-up a variable and toggle an output every 1000 times through the loop....or even every 32000 times through the loop....you might be able to measure that time with a stopwatch, and then you divide by 32000 to give you the time each loop takes to execute.
Be aware that these times change as you add or subtract from your program.....so you might need to keep this 'calibration' factor in there (commented out) in case you need to recalibrate it later on.
I would not rely on tight timing loops.....if you need a delay with say +/- 20%...no problem. If you are looking for very tight tolorances on the timer, I might try using a sensor to monitor a limit or progress of whatever you are trying to 'wait for'.
-Quentin
__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
|