Go to Post "Is it possible to cut enough holes in the robot to weight reduce 8 lbs?" - ScoutingNerd175 [more]
Home
Go Back   Chief Delphi > Technical > Control System
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
  #16   Spotlight this post!  
Unread 05-02-2004, 12:34
rdsideresistanc's Avatar
rdsideresistanc rdsideresistanc is offline
Registered User
AKA: Joel F
#0825 (SWVGS Maximus)
Team Role: Programmer
 
Join Date: Feb 2004
Location: nowhere
Posts: 11
rdsideresistanc is an unknown quantity at this point
Re: A few questions on programming the Control System

Quote:
Originally Posted by Joe Ross
you need to pass relayfwd and relayrev as pointers so that the modifications you make don't get "thrown out" when you exit the function.
You are correct about this.....hmm....could you possibly tell me how to pass them as pointers?
  #17   Spotlight this post!  
Unread 05-02-2004, 14:57
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Re: A few questions on programming the Control System

Quote:
Originally Posted by Mike Soukup
If they don't work, we're all in trouble since there's an enum in 'ifi_utilities.h'. Our current code has multiple enum's and we haven't had any problems with them.
enum's work. I've tried the code out on the compiler. It compiles perfectly and such.
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
  #18   Spotlight this post!  
Unread 05-02-2004, 15:18
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,590
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: A few questions on programming the Control System

Here is how I would implement the code (from which you should be able to figure out how to implement your code with pointers)

Code:
void toggle_single_solenoid(unsigned char button, unsigned char *prev_button, unsigned char *relay_fwd)
{
   if (button && !prev_button)     //don't keep toggling if they hold the button
      *relay_fwd = !(*relay_fwd);

   *prev_button = button;
}
call it like this:
Code:
 toggle_single_solenoid(p1_sw_trig, &prev_p1_sw_trig, &relay1_fwd);
Remember to declare prev_p1_sw_trig and change the variables to whichever switches and relays you want.
  #19   Spotlight this post!  
Unread 05-02-2004, 15:36
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
Re: A few questions on programming the Control System

I haven't tried it, but can you have a pointer to a bit field? relay1_fwd is a macro with the value LATDbits.LATD0. Just curious.
  #20   Spotlight this post!  
Unread 06-02-2004, 10:13
Avarik Avarik is offline
Registered User
#0022
 
Join Date: Jan 2004
Location: Chatsworth, CA
Posts: 75
Avarik is an unknown quantity at this point
Re: A few questions on programming the Control System

What exactly is prev_button?

And thanks...I've been at this for too long...

Shouldn't take me this long!
  #21   Spotlight this post!  
Unread 08-02-2004, 02:55
Avarik Avarik is offline
Registered User
#0022
 
Join Date: Jan 2004
Location: Chatsworth, CA
Posts: 75
Avarik is an unknown quantity at this point
Re: A few questions on programming the Control System

Alright, I finally figured it out! Here is how I did it.

Code:
if (p1_sw_trig && rel1==0)
{

	rel1++;
	if (rel2==0)
	{
	relay1_fwd=1;
	rel2++;
	}
	else
	{		
	relay1_rev=1;
	rel2--;
	}
						
}

if (!p1_sw_trig)
{
	rel1=0;
	relay1_fwd=0;
	relay1_rev=0;
}

rel1 and rel2 are simply declared as ints, where rel1 is initialized to 0, and rel2 to 1. This makes it go forward at first, then backwards the next time.
  #22   Spotlight this post!  
Unread 08-02-2004, 11:42
Adam Shapiro's Avatar
Adam Shapiro Adam Shapiro is offline
Registered User
FRC #0555 (Montclair Robotics)
Team Role: Alumni
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Montclair, NJ
Posts: 401
Adam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud of
Send a message via AIM to Adam Shapiro
Re: A few questions on programming the Control System

Quote:
Originally Posted by Avarik
Alright, I finally figured it out! Here is how I did it.

Code:
if (p1_sw_trig && rel1==0)
{

	rel1++;
	if (rel2==0)
	{
	relay1_fwd=1;
	rel2++;
	}
	else
	{		
	relay1_rev=1;
	rel2--;
	}
						
}

if (!p1_sw_trig)
{
	rel1=0;
	relay1_fwd=0;
	relay1_rev=0;
}

rel1 and rel2 are simply declared as ints, where rel1 is initialized to 0, and rel2 to 1. This makes it go forward at first, then backwards the next time.
Essentially my method.
__________________
Mentor to Teams 555, 1929, and 2070!
Currently working in hardware design at Cisco.
Cornell University DARPA Urban Challenge - http://www.cornellracing.com
Co-Captain Team 555 - 2003,2004,2005
Trust, Love, and Magic
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
What do you wish you knew about the new control system? Joe Ross Control System 2 09-01-2004 21:47
Need a FIRST Robotics control system kershawrobotics General Forum 3 07-07-2003 09:49
control system worth more than $500 archiver 2001 8 24-06-2002 02:00
control system programming archiver 2000 17 23-06-2002 22:14
Ok, how much is the control system worth? archiver 2001 6 23-06-2002 22:05


All times are GMT -5. The time now is 04:44.

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