|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
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) */
HELP!!! |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
|||||
|
|||||
|
Re: Main loop wierd problem
No, we are still using 2.6.
|
|
#4
|
||||
|
||||
|
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 |
|
#5
|
|||||
|
|||||
|
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.
|
|
#6
|
|||||
|
|||||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wierd search behavior.... | Salik Syed | Programming | 7 | 23-02-2006 13:12 |
| Very wierd compiling problem! | Max Brin | Programming | 6 | 08-02-2006 15:43 |
| problem with using a loop | CompMaster | Programming | 7 | 03-02-2006 16:44 |
| Rewriting main loop | Max Lobovsky | Programming | 4 | 04-01-2005 18:35 |
| Wierd basic init | Jeremy J | Programming | 5 | 06-02-2003 11:42 |