|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#3
|
|||
|
|||
|
Re: Interrupts, Interrupts, and more Interrupts!
How can the autonomous routine loop and loop and loop and never
(apparently) return and still work under MPLAB/WPILIB or EasyC? ---------------------------------------------------------------- I've done something similar before. Again, in the system clock routine check to determine when autonomous mode is ending (I was in autonomous last clock tick, but this time I'm not -- so autonomous period just ended). When you detect this, reset the variable stack managed by the C compiler and reset the hardware stack location (STKPTR) to point to the return to main(). For example, in the standard IFI code if: _entry (reset) jumps to _startup _startup then calls main() main() then calls Autonomous() Code:
main()
{
Autonomous();
Operator();
}
Autonomous()
{
while(1)
{
// user code here...
}
}
Code:
0000 0001 _startup+n <- main's return will pop and use this 0002 _main+n <- autonomous' return will pop and use this Yeah, we could do the same thing between iterations through Autonomous(), but this way again we don't really care how long the code path through autonomous is, it will get yanked immediately into the Operator() code when autonomous ends. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How many interrupts is too many interrupts? | Madison | Programming | 14 | 08-02-2008 12:09 |
| More than 6 RC digital input interrupts? | Jared Russell | Programming | 2 | 06-02-2007 15:41 |
| Interrupts and Script Conundrums | Jon236 | Programming | 2 | 08-02-2005 23:01 |
| interrupts and putdata() | doy | Programming | 4 | 23-02-2004 22:45 |
| Interrupts and rotation sensors | kor | Programming | 3 | 12-02-2004 11:05 |