# PBASIC Loop Speed?

Posted by Jay Lundy at 1/27/2001 10:22 PM EST

Student on team #254, The Cheesy Poofs, from Bellarmine College Preparatory.

Hey,
I’m new to this competition and the first time I ever looked at the PBASIC code was two days ago. Anyway, how do you accurately calculate the loop speed (the length of time each pass through the program takes) in PBASIC. My team and I are planning on using the Gyro and it requires this information. Thanks.

Posted by Lloyd Burns at 1/28/2001 4:38 AM EST

Other on team #188, Woburn Robotics, from Woburn Collegiate and Canada 3000, ScotiaBank, Royal Bank Financial.

In Reply to: PBASIC Loop Speed?
Posted by Jay Lundy on 1/27/2001 10:22 PM EST:

: Hey,
: I’m new to this competition and the first time I ever looked at the PBASIC code was two days ago. Anyway, how do you accurately calculate the loop speed (the length of time each pass through the program takes) in PBASIC. My team and I are planning on using the Gyro and it requires this information. Thanks.

. Each time the OI sends a package of information, a packet number is assigned. Each time the RC receiver is kept waiting to receive a packet, it starts a timer, which appears to overflow for large amounts of time wasted. The results of the timer are available as delta_t.

. Into the default program, adjusted to allow variable “delta_t”, I inserted, after the toggle 7 statement, “Debug home,dec delta_t,cr” and “Pause(x)”. For 250

Posted by control guy at 1/29/2001 10:29 AM EST

Student on team #250 from HVCC.

In Reply to: Re: PBASIC Loop Speed?
Posted by Lloyd Burns on 1/28/2001 4:38 AM EST:

The program loops are roughly 1/40 sec. Although, the time between loops can vary if you lose signal momentarily. Also, depending on your code, a program loop may take longer some times around than other times. Such as if you had many strings of if statements and you’re having the program go here, then here, then here, etc., etc. Hope this helps.

Posted by Denny McBride at 1/28/2001 3:55 PM EST

Other on team #379, Robocats, from Girard High School.

In Reply to: PBASIC Loop Speed?
Posted by Jay Lundy on 1/27/2001 10:22 PM EST:

: Hey,
: I’m new to this competition and the first time I ever looked at the PBASIC code was two days ago. Anyway, how do you accurately calculate the loop speed (the length of time each pass through the program takes) in PBASIC. My team and I are planning on using the Gyro and it requires this information. Thanks.

If you are worried about how often the gyro is scanned, put it in a subroutine and call it up as often as you wish with in the main loop.