OCCRA
Go to Post The question is like asking "Is it better to drive by looking at a map the whole time or by remembering where you want to go and watching the road instead?" - lukevanoort [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-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 02-14-2005, 08:49 PM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
An inspired alumnus
AKA: Jamie Bliss
no team (previously 904 (D-cubed) and 1227 (Techno-Gremlins))
Team Role: Alumni
 
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
Send a message via ICQ to Astronouth7303 Send a message via AIM to Astronouth7303 Send a message via MSN to Astronouth7303 Send a message via Yahoo to Astronouth7303
Syntax Error: externs, structs, and macros

Here's the thing: I'm getting a syntax error in 2 seperate lines that are probably related. I have narrowed it down to the point that I know that it is not the next or previous line.

They are:
Code:
BEGIN_MOTOR_LIST(motor_list)
	MOTOR(STRAIGHT,	LeftDrive,	OI_Left,	0,	0,	 0,	 0,	0,	254,	254) //ME! ME!
//...
END_MOTOR_LIST
Code:
REF_MOTOR_LIST(motor_list);
Here are the dependencies needed to get this:
Code:
#ifdef _MOTORS_H_
#define _MOTORS_H_

typedef enum {NONE,STRAIGHT,POSITION,FISHER} MotorType;

struct motors
{
	enum Motor type;
	char* pwm;
	char* oi;
	char pot;
	char pot_min;
	char pot_max;
	char pot_center;
	char pwm_min;
	char pwm_max;
	char pwm_change;
}

#define BEGIN_MOTOR_LIST(name) struct motors rom name[] = {
#define END_MOTOR_LIST                   {NONE, 0, 0, 0, 0, 0, 0, 0, 0} };
#define REF_MOTOR_LIST(name) extern struct motors name[]
#define PTR_MOTOR_LIST(name) struct motors *name
#define MOTOR(type,pwm,oi,pot,pot_min,pot_max,pot_center,pwm_min,pwm_max,pwm_change) {type, &pwm, &oi, pot, pot_min, pot_max, pot_center, pwm_min, pwm_max, pwm_change },

void DoMotors(PTR_MOTOR_LIST(motorlist));
#endif
Code:
char LeftDrive, RightDrive, E2;
#define OI_Left  p1_y
(unfortunately, it inserted random spaces)

Enlightenment?
  #2   Spotlight this post!  
Unread 02-14-2005, 09:54 PM
Orborde Orborde is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Apr 2004
Rookie Year: 2003
Location: Indianapolis, IN
Posts: 44
Orborde has a spectacular aura aboutOrborde has a spectacular aura about
Send a message via AIM to Orborde
Re: Syntax Error: externs, structs, and macros

Code:
#define MOTOR(type,pwm,oi,pot,pot_min,pot_max,pot_center,p  wm_min,pwm_max,pwm_change) {type, &pwm, &oi, pot, pot_min, pot_max, pot_center, pwm_min, pwm_max, pwm_change },
Might it be the marked bit?
  #3   Spotlight this post!  
Unread 02-14-2005, 11:30 PM
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,352
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: Syntax Error: externs, structs, and macros

I didn't spot anything wrong off-hand (other than the space noted by the previous poster, but I'm guessing that was a copy/paste problem?). Something you might try to narrow down the problem is pre-processing the C file to see how your macros worked out. There should be a cpp18.exe as part of the MCC18 package - this is the C preprocessor. Just run:
Code:
cpp18 {filename}.c -I{path to MCC18 include directory} > {filename}.pre
and it will spit the preprocessed file out to {filename}.pre. That might yield some clues.
  #4   Spotlight this post!  
Unread 02-16-2005, 02:39 PM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
An inspired alumnus
AKA: Jamie Bliss
no team (previously 904 (D-cubed) and 1227 (Techno-Gremlins))
Team Role: Alumni
 
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
Send a message via ICQ to Astronouth7303 Send a message via AIM to Astronouth7303 Send a message via MSN to Astronouth7303 Send a message via Yahoo to Astronouth7303
Re: Syntax Error: externs, structs, and macros

Quote:
Originally Posted by Orborde
Code:
#define MOTOR(type,pwm,oi,pot,pot_min,pot_max,pot_center,p  wm_min,pwm_max,pwm_change) {type, &pwm, &oi, pot, pot_min, pot_max, pot_center, pwm_min, pwm_max, pwm_change },
Might it be the marked bit?
Nope. That's just from the post. Try as I did, I couldn't get rid of it. But it doesn't exist in the file.

Quote:
Originally Posted by Dave Flowerday
I didn't spot anything wrong off-hand (other than the space noted by the previous poster, but I'm guessing that was a copy/paste problem?). Something you might try to narrow down the problem is pre-processing the C file to see how your macros worked out. There should be a cpp18.exe as part of the MCC18 package - this is the C preprocessor. Just run:
Code:
cpp18 {filename}.c -I{path to MCC18 include directory} > {filename}.pre
and it will spit the preprocessed file out to {filename}.pre. That might yield some clues.
Cool! Thanks! I'll try that!
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


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

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


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