Go to Post Because FIRST wants everyone to have a sense of accomplishment even if you didn't accomplish anything during the match. - Koko Ed [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 06-05-2005, 09:23
pagemauck pagemauck is offline
Registered User
#0437
 
Join Date: Oct 2003
Location: richmond, va.
Posts: 25
pagemauck is an unknown quantity at this point
internal demons?

We're at our wits end! Two of my C++ students and I are programming with the banner sensors to control wheel rpms. The program will run correctly for a few runs and then inexplicably decide to switch motor outputs ( from pwm01 to pwm02 or whatever we have them set to) and inputs from the light sensors . This has been happening for several weeks. I have redownloaded the master control program, swapped controllers, used different digital inputs ( 6 and 7 or 1 and 2) to no avail. Has anyone had this happen to them before?

Thanks!!

Team 539 programming group
  #2   Spotlight this post!  
Unread 06-05-2005, 10:42
Jack Jones Jack Jones is offline
Retired
no team
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Waterford, MI
Posts: 964
Jack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond reputeJack Jones has a reputation beyond repute
Re: internal demons?

Runtime errors are seldom, if ever, inexplicable.

Usually occur when memory gets hammered. Check to see if a string or array is getting written to past its declared end.
__________________
This message is hidden because Jack Jones is on your ignore list.
  #3   Spotlight this post!  
Unread 06-05-2005, 10:51
kc8nod's Avatar
kc8nod kc8nod is offline
Registered User
AKA: Ted Hansen
FRC #1216 (Knights)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Oak Park Michigan
Posts: 43
kc8nod is on a distinguished road
Re: internal demons?

It's very difficult to help you without any specifics. Please post the section of code where you think the problem is. Or better yet, zip up all the .c and .h files and attach them to your post.

The limited description you have given really sounds like a software problem. But you won't get any real help without posting the code.


Quote:
Originally Posted by pagemauck
We're at our wits end!...
  #4   Spotlight this post!  
Unread 07-05-2005, 23:30
Goldeye Goldeye is offline
Registered User
AKA: Josh Hecht
FRC #0694 (Stuypulse)
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2005
Location: New York
Posts: 145
Goldeye has a spectacular aura aboutGoldeye has a spectacular aura aboutGoldeye has a spectacular aura about
Send a message via AIM to Goldeye
Re: internal demons?

First impulse is that you're using a high priority interrupt. Anything can go wrong when you do. Post any code related to interrupts, if you use them. This is assuming you're using interrupts with them, of course. I suppose there's no guarantee of this.
__________________
Team 694

2005 Championship - Galileo Semifinalist
2005 New York - Regional Chairmans Award
2005 New York - Semifinalist (Thanks 1257,1340)
  #5   Spotlight this post!  
Unread 09-05-2005, 09:35
pagemauck pagemauck is offline
Registered User
#0437
 
Join Date: Oct 2003
Location: richmond, va.
Posts: 25
pagemauck is an unknown quantity at this point
Re: internal demons?

Thanks for the replies to my vague question. Specifically what I'm seeing is outputs switched in the printf statements. Does anyone know of a good place to find info on them?

Example :

(We are trying to print motor speed and banner sensor output)

printf ( "%d/n", " pwm01 = ", pwm01 );
printf ( "%d/n", " rc_dig_01 = ", rc_dig_01 );

Output

pwm01 = 1
rc_dig_01 = 145 // these numbers are switched

How do we rewrite the printfs to get what we want?

Thanks!
  #6   Spotlight this post!  
Unread 09-05-2005, 10:42
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: internal demons?

Quote:
Originally Posted by pagemauck
printf ( "%d/n", " pwm01 = ", pwm01 );
printf ( "%d/n", " rc_dig_01 = ", rc_dig_01 );
That doesn't look right at all. Try this instead:
Code:
printf(" pwm01 = %d/n", pwm01);
printf(" rc_dig_01 = %d/n", rc_dig_01);
Also, make sure you're not trying to do printf() inside any of the interrupt service routines.
  #7   Spotlight this post!  
Unread 09-05-2005, 10:51
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: internal demons?

Quote:
Originally Posted by Alan Anderson
That doesn't look right at all. Try this instead:
Code:
printf(" pwm01 = %d/n", pwm01);
printf(" rc_dig_01 = %d/n", rc_dig_01);
On top of that you want to use \n instead of /n.
Code:
printf(" pwm01 = %d\n", pwm01);
printf(" rc_dig_01 = %d\n", rc_dig_01);
Depending on what you're using to view the output, you may need to substitute a \r for the \n.
  #8   Spotlight this post!  
Unread 09-05-2005, 10:57
kc8nod's Avatar
kc8nod kc8nod is offline
Registered User
AKA: Ted Hansen
FRC #1216 (Knights)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Oak Park Michigan
Posts: 43
kc8nod is on a distinguished road
Re: internal demons?

Quote:
Originally Posted by pagemauck
printf ( "%d/n", " pwm01 = ", pwm01 );
printf ( "%d/n", " rc_dig_01 = ", rc_dig_01 );
Two things:

First, that doesn't look like proper use of the printf function. I think you meant to write this:
Code:
printf ( "pwm01 = %d/n", pwm01 );
printf ( "rc_dig_01 =  %d/n", rc_dig_01 );
Is that really the code you are using? Because I wouldn't think that what you have shown above would even compile.

Secondly, you still haven't given very much information. You'll notice that all the replies so far (including my own) have been guesses and speculation. Please post the whole function at a minimum. However, if you post all the code, I guarantee that someone here will fix your problem for you right away.
  #9   Spotlight this post!  
Unread 09-05-2005, 11:02
kc8nod's Avatar
kc8nod kc8nod is offline
Registered User
AKA: Ted Hansen
FRC #1216 (Knights)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Oak Park Michigan
Posts: 43
kc8nod is on a distinguished road
Re: internal demons?

Here is a pretty good explanation of the printf() function.
http://colton.byuh.edu/courses/tut/printf.pdf
  #10   Spotlight this post!  
Unread 09-05-2005, 15:10
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: internal demons?

Quote:
Originally Posted by kc8nod
Code:
printf ( "pwm01 = %d/n", pwm01 );
printf ( "rc_dig_01 =  %d/n", rc_dig_01 );
Don't forget to cast the "byte sized" arguments to printf,
intended to be formatted with %d, to an int. Byte sized
things get pushed on the stack as bytes, while printf
is expecting an int. This is a vagary of the C18 compiler
environment for the robot controller, and is non-standard.

This addresses bad values printed by printf, but probably
not the trouble you are trying to debug...
  #11   Spotlight this post!  
Unread 09-05-2005, 16:00
kc8nod's Avatar
kc8nod kc8nod is offline
Registered User
AKA: Ted Hansen
FRC #1216 (Knights)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Oak Park Michigan
Posts: 43
kc8nod is on a distinguished road
Re: internal demons?

Quote:
Originally Posted by eugenebrooks
Don't forget to cast the "byte sized" arguments to printf...
Good point!

So then, the proper code would be:
Code:
printf ( "pwm01 = %d\r", (int)pwm01 );
printf ( "rc_dig_01 =  %d\r", (int)rc_dig_01 );
  #12   Spotlight this post!  
Unread 09-05-2005, 17:32
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: internal demons?

Quote:
Originally Posted by kc8nod
Is that really the code you are using? Because I wouldn't think that what you have shown above would even compile.
Actually, it will. The compiler only knows that printf() takes a string as the first argument, and then zero or more arguments of any type. It does not type-check these arguments and the argument list is parsed at runtime. The way it was originally written, after the format string is another string, but the printf() function would try to interpret this as an integer (because of the %d in the format string).
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
Internal vs. External Gear teeth - same profile? sanddrag Technical Discussion 7 01-03-2005 10:44
Change from External to Internal teeth sanddrag Inventor 10 27-02-2005 23:59
Where to purchase internal gears? sanddrag Technical Discussion 3 27-02-2005 05:22
Fisher Price Internal Fan Blades sanddrag Motors 8 06-02-2005 14:27
Speed loss due to internal friction patrickrd Technical Discussion 1 23-01-2002 22:12


All times are GMT -5. The time now is 00:18.

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