Go to Post If it walks like a duck, and talks like a duck could be a very clever animatronics display created by Disney Imagineers.... Sometimes it is just a duck. - IKE [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 12-02-2003, 09:41
cammie825 cammie825 is offline
Registered User
#0825 (Maximum Velocity)
 
Join Date: Jan 2003
Location: Galax, VA
Posts: 8
cammie825 is an unknown quantity at this point
Send a message via ICQ to cammie825
And yet, ANOTHER questions

I know you guys are thrilled to hear another question for me. But, forgive me, I'm truly not very good at this. And at the crucial moments, I am able to think even less...

I have this compressor code. If anyone can find something wrong with my syntax, or something else, please let me know.

Thanks!

high_pressure VAR rc_sw2
compressor VAR relay3_fwd


pressure_check:
If high_pressure = 0 THEN compressor_go_on
If high_pressure = 1 THEN compressor_go_off

compressor_go_on:
compressor = 1
goto end_pump

compressor_go_off:
compressor = 0
goto end_pump

end_pump:
  #2   Spotlight this post!  
Unread 12-02-2003, 10:01
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
The first thing I notice is that the pressure switch values are reversed. The pressure switch is normally closed, and opens when the system pressure reaches 115 psi. So I would change your code like so:
Code:
If high_pressure = 1 THEN compressor_go_on
If high_pressure = 0 THEN compressor_go_off
(I think I would also change the pressure switch alias to low_pressure instead of high_pressure.)
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #3   Spotlight this post!  
Unread 12-02-2003, 10:36
yangotang's Avatar
yangotang yangotang is offline
Registered User
#0253 (MRT)
Team Role: Programmer
 
Join Date: Jan 2003
Location: San Mateo, California
Posts: 128
yangotang is on a distinguished road
Send a message via AIM to yangotang
Re: And yet, ANOTHER questions

Quote:
Originally posted by cammie825

pressure_check:
If high_pressure = 0 THEN compressor_go_on
If high_pressure = 1 THEN compressor_go_off
pressure_check:
If high_pressure = 0 THEN gosub compressor_go_on
If high_pressure = 1 THEN gosub compressor_go_off


i believe you forgot the gosub command. i may be wrong though.
  #4   Spotlight this post!  
Unread 12-02-2003, 10:54
cammie825 cammie825 is offline
Registered User
#0825 (Maximum Velocity)
 
Join Date: Jan 2003
Location: Galax, VA
Posts: 8
cammie825 is an unknown quantity at this point
Send a message via ICQ to cammie825
Actually wasn't my fault

The team has a problem with blaming all mistakes on the programming. This time, my friend, it was the electrician's fault... haha.. Oh well.
Thanks anyway!
  #5   Spotlight this post!  
Unread 12-02-2003, 12:39
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
easier code (even though your's does work)

compressor = high_pressure
  #6   Spotlight this post!  
Unread 12-02-2003, 16:02
ChrisA's Avatar
ChrisA ChrisA is offline
Registered User
#0857 (Superior Roboworks)
Team Role: College Student
 
Join Date: Feb 2002
Location: Michigan Tech
Posts: 157
ChrisA is on a distinguished road
Send a message via AIM to ChrisA
Re: Re: And yet, ANOTHER questions

Quote:
Originally posted by yangotang
pressure_check:
If high_pressure = 0 THEN gosub compressor_go_on
If high_pressure = 1 THEN gosub compressor_go_off


i believe you forgot the gosub command. i may be wrong though.
Using the gosub command makes the label act as a subroutine. In otherwords, you are able to use the return command to go back to where you left off. In an if then statement, any label stated after the then is considered to be a goto statement. The goto command simply jumps to the corresponding label and does not allow usage of the return command.
__________________
Programmer
----------------
Team#857
Superior Roboworks

WildStang Alum
  #7   Spotlight this post!  
Unread 13-02-2003, 00:37
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
question

Quote:
Originally posted by gwross
Code:
If high_pressure = 1 THEN compressor_go_on
If high_pressure = 0 THEN compressor_go_off
if the pressure is high, why would on want to turn on the compressor? Subsequently, if high_pressure = 0, meaning the pressure was not high, wouldn't you want to turn on the compressor, not turn it off? cammie got it right in the beginning. but joe ross does have a point on how to make the code easier, though i would change it to this:
Code:
compressor = ~high_pressure
~ being the symbol for NOT

-Kesich
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year

Last edited by Anthony Kesich : 13-02-2003 at 00:39.
  #8   Spotlight this post!  
Unread 13-02-2003, 00:49
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
the switch is closed (1) when it is below pressure and open (0) when it is full. See the pneumatics manual

Quote:
we have switches provided by the Nason company. These switches are normally closed. The switches open at approximately 115 psi and will close again at approximately 95 psi
thus, compressor = high_pressure is correct. do not use the ~.

Like gwross said, the variable name high_pressure is a misnomer. It is a 1 when low pressure, and so should probably be called low_pressure

Last edited by Joe Ross : 13-02-2003 at 01:08.
  #9   Spotlight this post!  
Unread 13-02-2003, 14:48
Greg McCoy's Avatar
Greg McCoy Greg McCoy is offline
boiler up!
FRC #3940 (CyberTooth)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Kokomo, IN
Posts: 484
Greg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond reputeGreg McCoy has a reputation beyond repute
Send a message via AIM to Greg McCoy
Re: And yet, ANOTHER questions

Quote:
Originally posted by cammie825
I know you guys are thrilled to hear another question for me. But, forgive me, I'm truly not very good at this. And at the crucial moments, I am able to think even less...
Don't get discouraged! Programming (like just about everything else) takes a lot of practice to become good at it. The more you do it, the more natrual the thought process and the more natrual the code will come. Places like this message board are great places for getting your code checked and for even some old(er) hands at this to learn something new
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
A few questions goegan31 Regional Competitions 1 09-03-2003 20:32
$3500 limit - Who does not have questions Raul Rules/Strategy 5 12-01-2003 11:31
traction questions AlbertW Rules/Strategy 2 05-01-2003 17:58
pre-inspection preparation questions Adams High Man OCCRA 7 22-10-2002 22:22
Update 7 - Behind Schedule (or out of questions)? archiver 2000 2 23-06-2002 22:58


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

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