Go to Post Friends don't let friends prototype alone. - SenorZ [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 19-02-2004, 16:45
wun's Avatar
wun wun is offline
Registered User
AKA: David Wolever
#0865 (Warp7)
Team Role: Programmer
 
Join Date: Dec 2003
Rookie Year: 2001
Location: Toronto
Posts: 84
wun will become famous soon enough
Send a message via AIM to wun Send a message via MSN to wun
Switch/case trouble (FIXED)

Hey,
I have been getting the following compile error ever since I added a certan function with a switch/case statement.
/cygdrive/c/mcc18/bin/mcc18.exe -p=18F8520 "user_routines.c" -fo="user_routines.o" /i"C:\\mcc18\\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
c:\robotics\FrcCode\user_routines.c:325:Error: syntax error
(note: This is the methoud I have used to compile code, and it has worked before)
Here is the code that is causing the error:

void Drive_the_Arm(void){
switch (light_status){
case NONE_IN_RANGE: Search_for_Light(LARGE_MOVE); <-- this line here is giving the error
break;

light_status is an unsigned charicter that has been defined as 0, NONE_IN_RANGE has been defined as 0 and LARGE_MOVE has been defined as 240. Search_for_Light is a function that accepts unsigned chars.
Does anyone have any ideas on what could be causing this error?
Thanks!
[edit]
I just realized I was declaring LARGE_MOVE like this:
#declare LARGE_MOVE 160;
I didnt know that it would replace LARGE_MOVE with 160; (I thought it would just be 160).
[/edit]
__________________
Help Microsoft stop piracy. Use Linux!

I have three gmail invitations, message me if you want one

Last edited by wun : 19-02-2004 at 17:01.
  #2   Spotlight this post!  
Unread 19-02-2004, 17:00
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Switch/case trouble

Quote:
Originally Posted by wun
Hey,
I have been getting the following compile error ever since I added a certan function with a switch/case statement.
/cygdrive/c/mcc18/bin/mcc18.exe -p=18F8520 "user_routines.c" -fo="user_routines.o" /i"C:\\mcc18\\h" -D_FRC_BOARD -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
c:\robotics\FrcCode\user_routines.c:325:Error: syntax error
(note: This is the methoud I have used to compile code, and it has worked before)
Here is the code that is causing the error:
Code:
void Drive_the_Arm(void){
 switch (light_status){
  case NONE_IN_RANGE: Search_for_Light(LARGE_MOVE);	       break;
light_status is an unsigned charicter that has been defined as 0, NONE_IN_RANGE has been defined as 0 and LARGE_MOVE has been defined as 240. Search_for_Light is a function that accepts unsigned chars.
Does anyone have any ideas on what could be causing this error?
Thanks!
First of all, no tabs and use the CODE tag.
Second, try:
Code:
void Drive_the_Arm(void)
{
 switch (light_status)
 {
  case NONE_IN_RANGE:
   Search_for_Light(LARGE_MOVE);
   break;
 }
}
I believe that the colon also denotes lablels, And I think that you can't have commands on the same line (I certainly wouldn't!). Try that.

Also, is Large move a const or alias?
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
Anyone else having trouble keeping up with work? D. Gregory General Forum 36 28-03-2004 16:55
4-wheel drive trouble Guilherme Technical Discussion 28 20-02-2004 14:16
trouble with beacon tracking code [53] opticruzer Programming 9 27-01-2004 12:19
Having trouble accessing FIRST's site... archiver 2000 1 23-06-2002 22:24
New Haven ball trouble Jeff Rodriguez Regional Competitions 1 04-04-2002 21:47


All times are GMT -5. The time now is 10:47.

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