|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Pressure switch code
under which heading do we put the pressure switch code!!!!!!!!!!!!!!!!!?????????????!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!
![]() |
|
#2
|
|||
|
|||
|
Re: Pressure switch code
Quote:
|
|
#3
|
||||
|
||||
|
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 } |
|
#4
|
|||||
|
|||||
|
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. Last edited by jacob_dilles : 21-02-2004 at 22:16. Reason: elaboration... |
|
#5
|
||||
|
||||
|
Re: Pressure switch code
Quote:
![]() |
|
#6
|
|||||
|
|||||
|
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
|
|
#7
|
|||||
|
|||||
|
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?
|
|
#8
|
|||
|
|||
|
Re: Pressure switch code
Quote:
Code:
relay8_fwd = !rc_dig_in18; relay8_rev = 0; |
|
#9
|
||||||
|
||||||
|
Re: Pressure switch code
Quote:
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. |
|
#10
|
||||
|
||||
|
Re: Pressure switch code
Quote:
As far as four lines, six lines, or two lines in ASM- this isn't ASM. |
|
#11
|
|||||
|
|||||
|
Re: Pressure switch code
Quote:
![]() |
|
#12
|
|||||
|
|||||
|
Re: Pressure switch code
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |