Go to Post We asked the neighbors if we could block the road before we did it. We had the rack out for a couple of hours. They are getting used to us doing odd things during build season. - wendymom [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-11-2003, 00:33
Jferrante Jferrante is offline
Registered User
#0506
 
Join Date: Aug 2002
Location: New York
Posts: 67
Jferrante is an unknown quantity at this point
Send a message via AIM to Jferrante Send a message via Yahoo to Jferrante
new to C. need some help

I am new to C, C++, and programming in general. The only programming experience I have is in PBasic for the 3 years I have been involved in FIRST. I find I learn best through examples rather than long explanations. For that reason I was wondering if someone could give me a few examples here, as detailed as possible.
If anyone has a pump delay program that say, only let the pump turn on 300 cycles after the pressure sensor closed, and that turned the pump off as soon as the sensor opened. Also how many cycles is 1 second (i know it used to vary with length of code).
Also if someone has a pump delay that turns the pump off when one sensor opened, and on when the other one closed (as i think most teams used to do).
Please include which files to put what in and why. Like I said I am very new to this. any other codes you can offer would be much appreciated. the more I have to look at and compare the faster i will be able to learn it.
Thanks
__________________
GodBless America
September 11, 2001... NEVER FORGET!
All Gave Some. Some Gave All. How much are you willing to give?
FDNYPD
  #2   Spotlight this post!  
Unread 06-11-2003, 06:43
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
There is no need to "guestimate". The PIC has a number of timers built in... Please read the manual for details.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #3   Spotlight this post!  
Unread 06-11-2003, 10:21
Sachiel7's Avatar
Sachiel7 Sachiel7 is offline
<Yes I managed to flip it
AKA: Shayne Helms
FRC #1132 (RAPTAR Robotics)
 
Join Date: Sep 2002
Rookie Year: 2002
Location: Richmond, VA
Posts: 541
Sachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really nice
Send a message via AIM to Sachiel7
OK Here's how to pull it off:
The main File you want to edit is User_Routines.c, not User_Routines_Fast, or anything else(for the main loop).
Scroll down to the Process_Master_uP Function. This is the main loop. Start writing after the Get_tx command.

Since User_Routines.C executes every 17ms, One Second is equal to 58 cycles.
This is how I handle my autonomous code(sorta):

counter ++; //This makes the counter value increase by one every cycle

if (counter > 300)
{
Do_Function_2
else
Do_Function_1
}

Thats the Guts of it. I would browse the alias.h file, so you can see what variables are mapped to what inputs/outputs.
If you're having trouble with C, it's not TOO different from basic, once you get used to it. You can find some info on C here:

http://www.strath.ac.uk/IT/Docs/Ccourse/

Just scroll around and take a look.
I personally spent this past summer reading Sams latest "Learn C++ in 24 hours" book, and my dad's old Kernighan & Ritchie Books. I also keep the ol' Harbison & Steele C reference manual around for when things get funny.

I think I might post a sample auto program up in the white papers and link it here. I use a table-based method of control. An array holds movement data, with the time for each function to last. This can be adapted with extreme ease.
Anyway, hope this helped a little bit.
__________________
-=Sachiel7=-

There's no such thing as being too simple!
Look for Team #1132, RAPTAR Robotics at the VCU Regional this year!
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 09:35.

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