Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Main loop wierd problem (http://www.chiefdelphi.com/forums/showthread.php?t=63727)

Tottanka 10-02-2008 14:40

Main loop wierd problem
 
We hooked up our sensors, and use Kevin's ADC code to pull them.
Then we check for new adc data in the Process_Data_From_Local_IO() function in user rutines fast.
That is all fine and well (as in, it works exacly like it should).
We recently started to mess around with the autonomus mode, and our debug messages show us that sensor data isn't being updated while we set the autonomus button. when we unset it, the sensor data does gets updated.
We checked and Process_Data_From_Local_IO() isn't even called.
Code:

while (1)  /* This loop will repeat indefinitely. */
  {
#ifdef _SIMULATOR
    statusflag.NEW_SPI_DATA = 1;
#endif

    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 */
      }
    }
    Process_Data_From_Local_IO();    /* You edit this in user_routines_fast.c */
                                      /* I'm fast!  I execute during every loop.*/
  } /* while (1) */

There is no aperent reason for the autonomus code and mode to affect the runing of the main loop, but for some reason it does.
HELP!!!

Jon236 10-02-2008 14:44

Re: Main loop wierd problem
 
Liron

Are you using Kevin's new code that uses the 3.0 C compiler? The ADC functions included in that build work well.

Jon

Tottanka 10-02-2008 14:46

Re: Main loop wierd problem
 
No, we are still using 2.6.

Jon236 10-02-2008 14:48

Re: Main loop wierd problem
 
Try this code. ifi_frc_sensor.zip at http://www.kevin.org/frc/
from Kevin.org you can get the C compiler update and MPLab update (8.0) from microchip.com

Tottanka 10-02-2008 14:56

Re: Main loop wierd problem
 
the problem dosen't appear to be in kevin's code. it's the first thing we checked. the "cpu" dosn't seem to get to our sensor data pooling function for no aperent reason.

Mark McLeod 10-02-2008 15:14

Re: Main loop wierd problem
 
Just add a call to Process_Data_From_Local_IO() in User_Autonomous_Code()
between the while and the if NEW_SPI_DATA check.


All times are GMT -5. The time now is 23:53.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi