Go to Post Gatting your senior pic with robot = (Cool factor * infinity). :cool: - Elgin Clock [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 15-02-2005, 20:51
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Printf acting flaky

I'm having a few issues with calling printf - it sometimes leaves the format string (like %d) in the output. Something like this:

joyx = 127
joyx = 127
joyx = 127
joyx = %d
joyx = 127
etc...

It seems to be random.

Also, it doesn't seem to like to have information pushed at it multiple times through the main loop. Even though I push a \r\n at it (although the same thing happens with either \r or \n) it overwrites the last bit of output. Is there a buffer or something that can hold a limited amount of data? I never experienced any problems like this last year - did something change? I'm sorry if this seems like a trivial problem - but it's driving me absolutely insane.
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #2   Spotlight this post!  
Unread 16-02-2005, 12:08
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: Printf acting flaky

I had similar problems last year with printf outputs (using printf_lib). This began after I started using Kevin Watson's tracker code.

The problem was solved by modifying a #pragma statement to cause the compiler to save more processor context prior to servicing an interrupt (the trackers used interrupts to process the IR beacons).

Are you using interrupts? Like wheel encoders?

-norm
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.
  #3   Spotlight this post!  
Unread 16-02-2005, 12:30
Joel J's Avatar
Joel J Joel J is offline
do you..
no team
 
Join Date: May 2001
Rookie Year: 2000
Location: San Jose, CA
Posts: 1,445
Joel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond repute
Re: Printf acting flaky

What additional contexts? Right now I'm saving PROD, MATH_DATA, and .tmpdata .
__________________
Joel Johnson

Division By Zero (229) Alumni, 2003-2007
RAGE (173) Alumni, 1999-2003
  #4   Spotlight this post!  
Unread 16-02-2005, 19:47
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Printf acting flaky

I'm using a few timer interrupts currently (although not TMR0) and will be using digital input interrupts too.

What else should I save?
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #5   Spotlight this post!  
Unread 20-02-2005, 11:54
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Printf acting flaky

Also, how often are you printing stuff, and how many characters. What is your interrupt rate? What serial drivers are you using?
  #6   Spotlight this post!  
Unread 20-02-2005, 12:52
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Printf acting flaky

I'm printing stuff once every 15 data packets (26.2*15=393 so about every .4 seconds) and it's about twenty-ish characters long. The only interrupt firing right now is the timer 1 overflow interrupt. I'm not using the TTL serial port, and I haven't fiddled with whatever code comes as default for printf.
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #7   Spotlight this post!  
Unread 20-02-2005, 14:02
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Printf acting flaky

Quote:
Originally Posted by steven114
joyx = 127
joyx = 127
joyx = %d
joyx = 127
etc...
This is a little too flaky for my taste.
Is this from a single printf statement or do you have two identical printf statements printing results in separate spots? The simplest explaination would be two similar printf's, but one with a typo like: printf("joyx = %d\r");
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #8   Spotlight this post!  
Unread 20-02-2005, 19:20
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Printf acting flaky

Same printf.
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
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
Printf symbol undefined? Help schenkin Programming 3 08-02-2005 16:14
printf problem miketwalker Programming 7 31-01-2005 13:19
Default Code and printf WilsonDJ00 Programming 2 22-01-2005 16:39
Anyone with a replacement Printf? Larry Barello Programming 5 19-03-2004 02:20
Printf warning during compile? actorindp Programming 4 20-02-2004 17:02


All times are GMT -5. The time now is 01:12.

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