Go to Post Were cargo shorts ever in fashion? I thought they were in the socks with sandals category. - AdamHeard [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 28-01-2008, 19:51
darkdwarven's Avatar
darkdwarven darkdwarven is offline
Registered User
AKA: Phantom
FRC #2348
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2005
Location: Hawaii
Posts: 8
darkdwarven is an unknown quantity at this point
Unhappy Switch Function Problems

I am using a switch function with MPLAB within the autonomous section fo user_routines_fast.c and the code I've written up does not seem to be executing...ever. For example, when I load the attached code, the motors attached to the PWM outputs only turn for 3-4 seconds and stop. I asked another team about it and their response was that the delay right above the while loop was the reason. I changed the value to 570 and the results were the same.

Do you think the numbers next to the "#define" section are the issue or does MPLAB hate us and the switch function alltogether?

Any and all help is appreciated!
Thanks in advance,
Team 2348.
Attached Files
File Type: txt switch_function.txt (2.6 KB, 61 views)

Last edited by darkdwarven : 28-01-2008 at 19:52. Reason: The smiley did not match with the title
  #2   Spotlight this post!  
Unread 28-01-2008, 20:01
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,586
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: Switch Function Problems

Code:
	static unsigned char delay;
  	static unsigned char direction;
	static unsigned char time;
An unsigned char's maximum value is 255. Since you want to use values greater then that for time, you should use an int.
  #3   Spotlight this post!  
Unread 29-01-2008, 03:16
darkdwarven's Avatar
darkdwarven darkdwarven is offline
Registered User
AKA: Phantom
FRC #2348
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2005
Location: Hawaii
Posts: 8
darkdwarven is an unknown quantity at this point
Re: Switch Function Problems

Thanks!

It works perfectly now. Next thing to do, figure out where we went wrong with IR sensors and I'm sure there is a thread out there with the information I need.
__________________
I have nothing important to say here, thus I've wasted a few seconds of your life. Isn't that depressing?
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, call of function without prototype problems cprogrammer Programming 3 11-05-2006 18:21
problems programming knob and switch caderader Programming 4 16-02-2006 16:45
Need Help Wiring Micro Switch/Limiting Switch Windward Electrical 2 07-02-2006 18:26
Labview problems and code problems ajsetter Programming 25 18-01-2006 17:07
Problems programming a switch caderader Programming 2 18-02-2005 22:06


All times are GMT -5. The time now is 19:07.

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