We have tried using the sample code provided here (replacing the IFI Vex headers with FRC controller headers).
However, this code triggers a code error on our RC.
Basically, the printf("_____________________\r\r"); line executes several times, then is interrupted for 3-5 seconds, then repeats, and IR input does nothing at all. After a few repetitions, the CODE ERROR light comes on. (This is all in autonomous mode).
After commenting out EVERYTHING inside the CheckIR function (leaving only void CheckIR(void) { } ), and commenting out the IR processing code (but leaving printf("_____________________\r\r"); inside the while loop) ), this problem still happens.
We are using the latest version of WPILib on a 2008 RC. Also, there are no compile-time warnings or errors.
You don’t want to be printing from within the CheckIR function. Since that is an interrupt service routine, there might be problems doing long operations like that. I could imagine printing causing the code error to occur. Otherwise, I’m not sure what is going on without more information.
Also, there were a few problems with the whole program that some people were able to find and correct so be sure to read all the comments in the thread.
As far as I know, the printf function isn’t being called within the CheckIR loop. The printf output comes in “bursts,” and the RC locks up after a few loops.
I am aware of those corrections; however, those don’t seem to be related to our problem.
Thank you.
I have partially resolved this problem. It only happens when “Code Model” under “Memory Model” under MPLAB C18 compiler options is set to “Large Code Model (>64K)”.
Is this expected behavior?
This sounds very familiar. We were having repeated problems (I don’t recall the specifics now) using the Camera-related functions in WPILIB. After lots of frustration, we tried switching the memory model from large to small. Doing so suddenly resolved the problems we were having!