RC Refresh Rate

Does anyone happen to know how often the RC will scan the code?

I’m trying to estimate how long something will go by saying increment the counter every loop but i don’t know how often it refreshes so therefore i don’t know how many increments i want it to count to…:mad:

Thanks in advnace

The 2007 & 08 RC’s execute the user code around 28-32 times per second, depending on the amount of time the code takes to execute.

    if (statusflag.NEW_SPI_DATA)      /* 26.2ms loop area */
    {                                 /* I'm slow!  I only execute every 26.2ms because */
                                      /* that's how fast the Master uP gives me data. */
      Process_Data_From_Master_uP();  /* You edit this in user_routines.c */

      if (autonomous_mode)            /* DO NOT CHANGE! */
      {
        User_Autonomous_Code();        /* You edit this in user_routines_fast.c */
      }
    }

Stuff in Process_Data_From_Master_uP() will be run every 26.2ms. Same with User_Autonomous_Code() (when the robot is in autonomous).

It doesn’t vary much to matter, if you have code that makes it take longer than 26.2ms to run it, it will explode.

Thanks! Thats exactly what i was looking for… I thought i had seen that in the code before but when i went to look for it i couldn’t find it

Can we figure out the loop time for the 2009 controller or do we have to wait for the default code?

Based on the information I’ve been able to scrape together about the new control system, I’m not sure “loop time” is going to be a valid concept. It looks like it’ll be more like the way EasyC works: if you want to keep track of time, or do something every so often, you’ll have to use real timers.

Just to head off any programming headaches, the User_Autonomous_Code() function is, in fact, only run once per autonomous mode. It doesn’t even loop. It instead has a while loop in it that the execution stays in until autonomous mode ends. There’s a section in this other while loop that has the same update rate, but it’s technically incorrect to say that User_Autonomous_Code itself is run every 26.2ms.

Also, the new controller could still be running tasks in fixed time loops. At least, it’s easily possible to do so on a Labview RT controller, though there are certainly other control methods they could be using. But for measuring elapsed time, it’d certainly be easier to start a timer and watch the elapsed time value instead of trying to count loops.