Go to Post The robot is NOT a lie. - Rick TYler [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-02-2004, 14:31
kingpin3787 kingpin3787 is offline
Registered User
#1340
 
Join Date: Jan 2004
Location: NWE YORK
Posts: 4
kingpin3787 has a little shameless behaviour in the past
Pressure switch code

under which heading do we put the pressure switch code!!!!!!!!!!!!!!!!!?????????????!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!
Reply With Quote
  #2   Spotlight this post!  
Unread 21-02-2004, 15:21
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Pressure switch code

Quote:
Originally Posted by kingpin3787
under which heading do we put the pressure switch code!!!!!!!!!!!!!!!!!?????????????!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!
I don't quite understand your question - do you mean which function should it go in? It really doesn't matter too much, although I think that ProcessDatafromMasterUP is the preferred place.
Reply With Quote
  #3   Spotlight this post!  
Unread 21-02-2004, 21:18
Robert Hafner's Avatar
Robert Hafner Robert Hafner is offline
FIRST Alumni
no team
 
Join Date: Mar 2003
Rookie Year: 2000
Location: Springfield. MA
Posts: 34
Robert Hafner is on a distinguished road
Send a message via AIM to Robert Hafner Send a message via MSN to Robert Hafner Send a message via Yahoo to Robert Hafner
Re: Pressure switch code

Let me see what I can do. . .

Our pressure switch code is wicked simple:

The pressure switch is on digital input 8, and the compressor is on relay 8.

in the initialization routine

relay8_fwd = 1; //Start with compressor on


In the default routine:

if(!rc_dig_in18)
{
relay8_fwd = 1; // If low air pressure, turn on
}else{
relay8_fwd = 0; // If high air pressure, turn off
}
Reply With Quote
  #4   Spotlight this post!  
Unread 21-02-2004, 22:14
jacob_dilles's Avatar
jacob_dilles jacob_dilles is offline
Registered User
AKA: theshadow
FRC #0620 (WarBots)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Vienna, VA
Posts: 245
jacob_dilles will become famous soon enough
Send a message via AIM to jacob_dilles
Re: Pressure switch code

if your not a fan of bulky code:

relay8_fwd = !rc_dig_in18;
relay8_rev = 0;

from there, the RC has a built in pull up on the (s) line. soo you connect the white to one side of the switch and the black to the otherside of the switch. that is, if your using a pwm style color coded cable. you dont need the positive at all. the pressure switch is N.C. meening that with this setup the normal signal will be 0 and when it closes it will be 1. therefore !rc_dig_in18 yeilds 1 when it is normal and 0 when it goes over. no if statment needed.
__________________
--------------------------
"You're not a real programmer until all your sentences end with semicolons;"

Last edited by jacob_dilles : 21-02-2004 at 22:16. Reason: elaboration...
Reply With Quote
  #5   Spotlight this post!  
Unread 21-02-2004, 22:16
Robert Hafner's Avatar
Robert Hafner Robert Hafner is offline
FIRST Alumni
no team
 
Join Date: Mar 2003
Rookie Year: 2000
Location: Springfield. MA
Posts: 34
Robert Hafner is on a distinguished road
Send a message via AIM to Robert Hafner Send a message via MSN to Robert Hafner Send a message via Yahoo to Robert Hafner
Re: Pressure switch code

Quote:
Originally Posted by jacob_dilles
if your not a fan of bulky code:

relay8_fwd = !rc_dig_in18;
relay8_rev = 0;
bulky? I was just trying to keep it simple. . .
Reply With Quote
  #6   Spotlight this post!  
Unread 21-02-2004, 22:25
jacob_dilles's Avatar
jacob_dilles jacob_dilles is offline
Registered User
AKA: theshadow
FRC #0620 (WarBots)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Vienna, VA
Posts: 245
jacob_dilles will become famous soon enough
Send a message via AIM to jacob_dilles
Re: Pressure switch code

every "if" statment is at least 4 lines in ASM. add an "else" and that adds 6 more lines. a boolean assinment is only 2 lines. but whatever
__________________
--------------------------
"You're not a real programmer until all your sentences end with semicolons;"
Reply With Quote
  #7   Spotlight this post!  
Unread 21-02-2004, 23:34
Chris Bright's Avatar
Chris Bright Chris Bright is offline
Registered User
#1023 (Bedford Express)
Team Role: Webmaster
 
Join Date: Feb 2003
Rookie Year: 2003
Location: Temperance, MI
Posts: 54
Chris Bright will become famous soon enough
Send a message via AIM to Chris Bright
Re: Pressure switch code

correct me if i am wrong but isn't the code for the pressure switch already in the default as long as you hook up the switch to digital input 18 and the pump to relay 8?
__________________
2003 - National Rookie All-stars
2003 - Great Lake Rookie All -stars
Reply With Quote
  #8   Spotlight this post!  
Unread 21-02-2004, 23:48
velocipenguin velocipenguin is offline
Registered User
#0246 (Overclocked)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Boston, MA
Posts: 77
velocipenguin is on a distinguished road
Send a message via AIM to velocipenguin
Re: Pressure switch code

Quote:
Originally Posted by Chris Bright
correct me if i am wrong but isn't the code for the pressure switch already in the default as long as you hook up the switch to digital input 18 and the pump to relay 8?
Yes. The default code contains the following lines, I believe:

Code:
relay8_fwd = !rc_dig_in18;
relay8_rev = 0;
Connect the pressure switch to the white and black wires of a cable plugged into digital input 18, and you should be all set (assuming you've connected the compressor's relay to relay output 8).
Reply With Quote
  #9   Spotlight this post!  
Unread 22-02-2004, 10:20
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,576
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: Pressure switch code

Quote:
Originally Posted by jacob_dilles
every "if" statment is at least 4 lines in ASM. add an "else" and that adds 6 more lines. a boolean assinment is only 2 lines. but whatever
There is a difference between it being easy for a human to read, and easy for a computer to understand.

Personally, I choose what is easier for me to understand, and in the 2% of cases where it needs to be fast, I write well commented assembly.
Reply With Quote
  #10   Spotlight this post!  
Unread 22-02-2004, 21:38
Robert Hafner's Avatar
Robert Hafner Robert Hafner is offline
FIRST Alumni
no team
 
Join Date: Mar 2003
Rookie Year: 2000
Location: Springfield. MA
Posts: 34
Robert Hafner is on a distinguished road
Send a message via AIM to Robert Hafner Send a message via MSN to Robert Hafner Send a message via Yahoo to Robert Hafner
Re: Pressure switch code

Quote:
Originally Posted by Joe Ross
There is a difference between it being easy for a human to read, and easy for a computer to understand.

Personally, I choose what is easier for me to understand, and in the 2% of cases where it needs to be fast, I write well commented assembly.
If people ask a question, I'll give easy to understand code. I just wrote that up real quick, and didn't bother to shove it in as few lines of code as possible.

As far as four lines, six lines, or two lines in ASM- this isn't ASM.
Reply With Quote
  #11   Spotlight this post!  
Unread 22-02-2004, 21:46
jacob_dilles's Avatar
jacob_dilles jacob_dilles is offline
Registered User
AKA: theshadow
FRC #0620 (WarBots)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Vienna, VA
Posts: 245
jacob_dilles will become famous soon enough
Send a message via AIM to jacob_dilles
Re: Pressure switch code

Quote:
Originally Posted by Robert Hafner
If people ask a question, I'll give easy to understand code. I just wrote that up real quick, and didn't bother to shove it in as few lines of code as possible.

As far as four lines, six lines, or two lines in ASM- this isn't ASM.
but it is compialed as such
__________________
--------------------------
"You're not a real programmer until all your sentences end with semicolons;"
Reply With Quote
  #12   Spotlight this post!  
Unread 22-02-2004, 21:52
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Pressure switch code

Quote:
Originally Posted by jacob_dilles
every "if" statment is at least 4 lines in ASM. add an "else" and that adds 6 more lines. a boolean assinment is only 2 lines. but whatever
Check out the listing of what the compiler produces. An "if" produces a bunch of assembly, but so does an assignment of bit-sized values.
Reply With Quote
Reply


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
connecting pressure switch kingpin3787 Pneumatics 2 19-02-2004 21:01
spike for pressure switch? Rob Colatutto Rules/Strategy 4 23-02-2003 15:42
pressure switch Michael Long Pneumatics 1 11-02-2003 11:21
lost pressure switch Josh Hambright Pneumatics 0 29-01-2003 08:30
Error found in programming for the pump and pressure switch sjharobotics Programming 4 06-02-2002 17:46


All times are GMT -5. The time now is 03:16.

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