|
Re: Robot Timing Code
"It's a nifty bit of code, but you can't use the wait() function on the IFI Robot Controller. "
You really need to qualify that since it is not true in all cases.
You can call wait functions at user level (non-interrupt routine level) in EasyC, MPLAB/WPILIB, and other environments.
In these cases the get/put data routines are run at interrupt level off the system clock ISR. Doing this stuff in the background/at interrupt level means you don't have to worry about what you're doing at the non-interrupt level like doing wait() calls. As long as you don't disable interrupts or don't perform waits at interrupt level then it will work just fine.
Bud
PS the other nifty thing that easyc/wpilib does is the system clock notices when autonomous period ends and causes the processor to do a warm reset/reboot from interrupt level effectively exiting autonomous and when the main loops starts again, the operator call/loop is run. I'd done something similar, but did so by putting a call marker on the h/w stack and then at interrupt level when auto mode ended I popped stuff off the stack until I hit the marker and then did a return from interrupt level so in main it looked like the auto() routine had returned by itself. The warm reboot is easier/faster but that means you have to go through the c main startup/init code again.
|