Go to Post Definitely read through ALL the documentation, and if you still have questions, ask. - Joe Ross [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2008, 20:03
d235j d235j is offline
Registered User
FRC #4454
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 25
d235j has a spectacular aura aboutd235j has a spectacular aura about
"Code Error" with RegisterRepeatingTimer

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.
  #2   Spotlight this post!  
Unread 19-02-2008, 02:48
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: "Code Error" with RegisterRepeatingTimer

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.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #3   Spotlight this post!  
Unread 19-02-2008, 16:48
d235j d235j is offline
Registered User
FRC #4454
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 25
d235j has a spectacular aura aboutd235j has a spectacular aura about
Re: "Code Error" with RegisterRepeatingTimer

Quote:
Originally Posted by BradAMiller View Post
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.
This is how our program looks:

Quote:
#include "BuiltIns.h"
#include "API.h"
#include "ifi_aliases.h"
#include "user_defs.h"
#include <p18cxxx.h>

void CheckIR(void)
{
// empty
}

void main(void)
{
RegisterRepeatingTimer(30, CheckIR);
while(1)
{
printf("TestRun\r\r");
}
}
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.
Quote:
Originally Posted by BradAMiller View Post
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.
I am aware of those corrections; however, those don't seem to be related to our problem.
Thank you.
  #4   Spotlight this post!  
Unread 22-02-2008, 13:38
d235j d235j is offline
Registered User
FRC #4454
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 25
d235j has a spectacular aura aboutd235j has a spectacular aura about
Re: "Code Error" with RegisterRepeatingTimer

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?
  #5   Spotlight this post!  
Unread 27-02-2008, 21:51
sfs sfs is offline
Registered User
AKA: Steve Siirila
FRC #2220 (Blue Twilight)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Eagan, MN
Posts: 18
sfs is an unknown quantity at this point
Re: "Code Error" with RegisterRepeatingTimer

Quote:
Originally Posted by d235j View Post
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!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Congratulations is spelled with a "T" and not a "D"!! Elgin Clock Thanks and/or Congrats 55 09-03-2007 13:24
Screenshot of "code not understood" or similar error needed! Elgin Clock Programming 3 17-02-2006 22:06
Code Errors With "Bells and Whistles" Ryan O Programming 2 31-01-2006 19:29
Code error on RC after downloading "bells and whistles" version of Kevins camera code DanDon Programming 6 10-01-2006 18:07
How "bad" are motors with "bad" stickers? cooknl Kit & Additional Hardware 20 12-01-2005 10:33


All times are GMT -5. The time now is 14:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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