Go to Post To paraphrase a common answer from the GDC: There is no rule that explicitly forbids this. - MechEng83 [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 03-09-2008, 21:24
dpeterson3 dpeterson3 is offline
Registered User
FRC #1178 (DURT)
Team Role: Alumni
 
Join Date: Aug 2008
Rookie Year: 2008
Location: St. Louis
Posts: 158
dpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the rough
Header files

Hello. I am new to programing. I am trying to upgrade last years code to use Kevin Watson's new code for the new compiler (I can only get my hands on the new one). Anyway, I have a problem with global variables. We had a file called globals.h which stored all our global variables. I copied it into the directory of the new code files, and the file itself compiles jsut fine. However, I call it from my homemade user routines file, and I end up with errors. The compiler spits back "E:\Backup\ifi_frc\globals.h:62:Error: syntax error" I don't understand. How can the header compile just fine on its own and not from another file? Any ideas

Another quick question. I have a printout of a file called oiboard.h in which the oi board inputs are mapped to such as "drt_aux1(sw_swtrig)" which refers to the trigger on the stick on input one. I assume this file is for the oi board and defines how the board sends signals. Am I correct? What I mean is does this code go on the oi board so when it sends data, instead of seeing p1_x, it sees drt_aux(x). I hope I made myself clear enough.

thanks
  #2   Spotlight this post!  
Unread 03-09-2008, 21:56
EricH's Avatar
EricH EricH is online now
New year, new team
FRC #1197 (Torbots)
Team Role: Engineer
 
Join Date: Jan 2005
Rookie Year: 2003
Location: SoCal
Posts: 19,789
EricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond repute
Re: Header files

Quote:
Originally Posted by dpeterson3 View Post
Hello. I am new to programing. I am trying to upgrade last years code to use Kevin Watson's new code for the new compiler (I can only get my hands on the new one). Anyway, I have a problem with global variables. We had a file called globals.h which stored all our global variables. I copied it into the directory of the new code files, and the file itself compiles jsut fine. However, I call it from my homemade user routines file, and I end up with errors. The compiler spits back "E:\Backup\ifi_frc\globals.h:62:Error: syntax error" I don't understand. How can the header compile just fine on its own and not from another file? Any ideas

Another quick question. I have a printout of a file called oiboard.h in which the oi board inputs are mapped to such as "drt_aux1(sw_swtrig)" which refers to the trigger on the stick on input one. I assume this file is for the oi board and defines how the board sends signals. Am I correct? What I mean is does this code go on the oi board so when it sends data, instead of seeing p1_x, it sees drt_aux(x). I hope I made myself clear enough.

thanks
I'm not sure about the first question, but the second question is easy: the OI (at least the old one) doesn't take any code of its own. You'll need to code the file into the robot code.
__________________
Past teams:
2003-2007: FRC0330 BeachBots
2008: FRC1135 Shmoebotics
2012: FRC4046 Schroedinger's Dragons

"Rockets are tricky..."--Elon Musk

  #3   Spotlight this post!  
Unread 03-09-2008, 22:56
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: Header files

What do you mean by "the file itself compiles jsut fine"?
Does the project compile without the header included?

Anyways, what's on line 63 / what's surrounding it?

(If you don't mind, zip up the project and post it - CD will find the problem rather quickly)
  #4   Spotlight this post!  
Unread 04-09-2008, 06:39
dpeterson3 dpeterson3 is offline
Registered User
FRC #1178 (DURT)
Team Role: Alumni
 
Join Date: Aug 2008
Rookie Year: 2008
Location: St. Louis
Posts: 158
dpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the rough
Re: Header files

What I mean is if I right click on the header file adn click "compile," the compiler builds it with no errors. If I right click on the acutal C file and click compile, I get the error. I would say it is in the C file, but line 63 is talking about some variables that are declared in the C file, so I doubt it. However, lines 61-63 in the header declare global variables for the gyro. I wonder if that might mean the variable is declare somewhere else, but the error still occurs when I comment out those three lines. I can't not include the header or I will get all kinds of errors. As I said, I am trying to use a lot of the origional code. When it was written, a lot of the main variables were stored there, so I will get a lot of errors by not includin it. I will zip it and post it as soon as I can. This computer can do zipped files.
  #5   Spotlight this post!  
Unread 04-09-2008, 12:23
AustinSchuh AustinSchuh is offline
Registered User
FRC #0971 (Spartan Robotics) #254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Los Altos, CA
Posts: 803
AustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond repute
Re: Header files

It will also be helpful if you posted the error message that the compiler spits out at you. Compilers normally have hundreds of different error messages that mean wildly different things.
  #6   Spotlight this post!  
Unread 04-09-2008, 18:35
dpeterson3 dpeterson3 is offline
Registered User
FRC #1178 (DURT)
Team Role: Alumni
 
Join Date: Aug 2008
Rookie Year: 2008
Location: St. Louis
Posts: 158
dpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the rough
Re: Header files

I appricate the help. I will have to get back later. I just tried building it one more time to make sure it gave me the same error. Now I get a whole bunch more. I know why. As I said earlier, the origional programmer made a header to define all the oi inputs that I do not have a copy of. I will have to make my own. I don't know why I didn't get these errors before. I expected to. I am starting to question how well my compiler is really working.

I somehow fixed the problem. Everything compiles just fine now. I am not sure what was wrong. I still think I might just have needed to reboot my computer. Windows adn windows programs tend to do funny things when they are left running too long. All I get are some function warnings, which I will have to work on. Anyway, they are not a big deal. However, I still have a small problem. I got this in an email

oiboard.h
/* Operator Interface Aliases */
// Joysticks
// - Each Joystick has 8 members, which should be supplied for 'i'.
// - There are 4 analog inputs: 'x', 'y', 'wheel', and 'aux'
// - And 4 switch inputs: 'sw_trig', 'sw_top', 'sw_aux1', and 'sw_aux2'
#define drt_driver(i) p2_##i
#define drt_operator(i) p4_##i
#define drt_aux1(i) p1_##i
#define drt_aux2(i) p3_##i
// Analog Knobs
#define drt_knob1 drt_aux1(x)
#define drt_knob2 drt_aux1(y)
#define drt_knob3 drt_aux1(wheel)
#define drt_knob4 drt_aux1(aux)
// Four more unused analog inputs on drt_aux2
// Three-Position Switches
#define drt_3p1_high drt_aux1(sw_trig)
#define drt_3p1_low drt_aux1(sw_top)
#define drt_3p2_high drt_aux1(sw_aux1)
#define drt_3p2_low drt_aux1(sw_aux2)
// Switches and buttons
#define drt_switch1 drt_aux2(sw_trig)
#define drt_switch2 drt_aux2(sw_top)
#define drt_push1 drt_aux2(sw_aux1)
#define drt_push2 drt_aux2(sw_aux2)
// State Switches
// - The State Switches are so called, because the switches are processed based
// - on the state of an analog input. With 4 switches per analog, there is
// - a total of 16 states.
#define drt_switch_set1 drt_aux2(x)
#define drt_switch_ser2 drt_aux2(y)
#define drt_switch3 DRT_StateSwitch(1)
#define drt_switch4 DRT_StateSwitch(2)
#define drt_switch5 DRT_StateSwitch(3)
#define drt_switch6 DRT_StateSwitch(4)
#define drt_push3 DRT_StateSwitch(5)
#define drt_push4 DRT_StateSwitch(6)
#define drt_push5 DRT_StateSwitch(7)
#define drt_push6 DRT_StateSwitch(8)
// Console LEDs
#define drt_LED1 Pwm1_green
#define drt_LED2 Pwm1_red
#define drt_LED3 Pwm2_green
#define drt_LED4 Pwm2_red
#define drt_LED5 Relay1_red
#define drt_LED6 Relay1_green
#define drt_LED7 Relay2_red
#define drt_LED8 Relay2_green

I know it was part of the problem. I do not have an original copy of the file. I think there might be more to it. All I know is one of my issues was a line of code that said

#define SW_PERCISION_DRIVE drt_driver(sw_trig)

and two others like it. Can someone tell me where that might be defined. I don't see it in this oiboard.h file and I can't figure out where else he might have mapped the origional input names to these names. For right now, I am just going to use the conventional names becaue I know they are defined

thanks

Last edited by dpeterson3 : 04-09-2008 at 20:57. Reason: Fixed the problem
  #7   Spotlight this post!  
Unread 07-09-2008, 13:14
dpeterson3 dpeterson3 is offline
Registered User
FRC #1178 (DURT)
Team Role: Alumni
 
Join Date: Aug 2008
Rookie Year: 2008
Location: St. Louis
Posts: 158
dpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the roughdpeterson3 is a jewel in the rough
Re: Header files

Thanks everyone. I just found out on Friday that they built a new OI. The files he sent me were for the new stuff. I also now have an update version of the 2.4 code, so everything is starting to make sense. I wish people would keep me informed.
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
Converting step files to inventor files GMAdan Inventor 4 01-01-2007 20:09
Header File Missing BloodSoakedTear Programming 1 26-02-2006 16:54
CAD Help needed. Mech Desktop 6 files backwards to AutoCAD 14? (2d files) Elgin Clock Inventor 0 30-08-2004 23:06
iTunes Header Code Joe Matt CD Forum Support 8 23-10-2003 19:36
XML Header Jack Website Design/Showcase 2 31-12-2002 14:04


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

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