Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Help With Compressor Code (http://www.chiefdelphi.com/forums/showthread.php?t=31544)

fred 02-12-2004 15:47

Help With Compressor Code
 
Hey! Our team is in need of code that will run a tank drive and a compressor for pneumatics. Any help and code would be appreciated, since we are new at pneumatics stuff. Thanks in advance.

Alan Anderson 02-12-2004 16:12

Re: Help With Compressor Code
 
The suggested code is simply to read a digital input from a pressure switch and copy its value out to a Spike wired up to the compressor. The pressure switch supplied in last year's kit of parts has two set points, turning on at about 95 PSI and off at about 115, so you don't have to worry about fancy programming unless you really want to.

I believe the default code wants the compressor on relay 8 and the switch on digital input 18, but don't take my word for it without checking first.

The default code is also already set up for tank drive. I don't remember which joystick inputs or pwm outputs it wants. Read the comments in the code; they are very helpful.

Tom Bottiglieri 02-12-2004 17:23

Re: Help With Compressor Code
 
if you dont want to just use the default code and would rather write it yourself to fully learn how it works, you can do something like this..

Put a line in the default routine that will call a function that will check the compressors pressure (whether the pressure switch is on or off).

If the switch's input goes high, turn on the compressor. Then when there is enough pressure the switch will change states and you can turn the compressor off.

In our program, we made "Compressor" an alias for a relay output (Relay 3 in our case), and "CompSwitch" an alias for the digital input the pressure switch was on. You can code these lines in the "user_routines.h" file with the syntax
Code:

#alias NewName    OldName
Our Compressor checking function looked like this.
Code:

void CheckComp(void)
{
        if(CompSwitch == 1)
        {
                Compressor  = 1;
        }
        else
        {
                Compressor = 0;
        }
}


Astronouth7303 04-12-2004 19:16

Re: Help With Compressor Code
 
I didn't know #alias was a valid preprocessor directive. I thought it would be
Code:

#define NewName OldName

EOC 21-01-2005 17:16

Re: Help With Compressor Code
 
I tried checking the default code and I couldn't find the compressor code. Where is it exactly? I'm new at this.

seanwitte 21-01-2005 17:32

Re: Help With Compressor Code
 
Quote:

Originally Posted by EOC
I tried checking the default code and I couldn't find the compressor code. Where is it exactly? I'm new at this.

Line 353 of the newest version of user_routines.c. Its only one line so its easy to miss. Requires the compressor to be connected to relay output 8 and the pressure switch to digital input 18.

Code:

relay8_fwd = !rc_dig_in18;  /* Power pump only if pressure switch is off. */

M. Hicken 21-01-2005 17:40

Re: Help With Compressor Code
 
I hate to be the search NAZI but please attempt to read through the search results. I started a thread almost identical to this one last week.

Sorry for ranting, but i see the mod's point


Marcus


All times are GMT -5. The time now is 02:54.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi