In programming the pump to be controlled by the pressure switch from the sample that we got from Chief Delphi about wiring and programming information for the pump and pressure switch, the program was not working because the two variables that control the relay were being written over in subsequent sections of the default code. These are relay5_fwd and relay5_rev. After entering the given code into the section for that in the default code, these variables were reinitialized in the section right below it. To solve the problem, just comment those two variables in the “Buttons to Relays” section.
I’ve seen quite a few examples of code posted. All of which we have had problems getting to run. We are a rookie team and this so far has been are greatest challenge.
Would it be possible for you to paste a copy of the code you are referring too? It would be a great help. Thanks in advance.
This is the program: :eek:
’ Test the state of the pressure switch
if rc_sw1 = 1then pump_on 'jump if under the pressure limit
’ 110 psi pressure limit has been reached
’ turn pump off
pump_off:
relay5_fwd = 0
relay5_rev = 0
goto nextaction:
'turn pump on
pump_on:
relay5_fwd = 1
relay5_rev = 0
nextaction:
you need to comment the lines containing these right below it
Hope this helps :eek:
Thanks for the help. Our programmer actually figured out his own code, works in a similar fashion:
'In Varibles section
'====== Compressor hold command variable====
HOLD VAR byte
'in “---------- Initialize Inputs & Outputs —”
'====== COMPRESSOR RUN CODE============
HOLD = 1
'====================================
'====== COMPRESSOR LIMIT RUN CODE========
'====================================
’
’
if rc_sw1 =0 then relayoff:
if rc_sw2 =1 then relayON:
if HOLD =1 then relayON:
goto endloop:
RelayON:
relay7_fwd = 1
hold =1
goto endloop:
RelayOFF:
relay7_fwd = 0
hold =0
Goto endloop:
EndLoop:
It may be a bit lengthy, but he figured it out Logic tables and all.
Thanks again…
If you are using two sensors for your pump, the following is the easiest code.
pump = alias to relayX_fwd
highsen = alias to rc_swY (the higher of two pressure sensors)
lowsen = alias to rc_swZ (lower of two pressure sensors)
the pressure sensors read 0 when full
…
pump_code:
If highsen <> lowsen Then end_pump
pump = 1 - (1 - highsen)
end_pump:
…
Basically when the two sensor values are equal (both are full or empty), the pump will engage depending on whether the high pressure sensor is tripped. Unless you clear your pump output variable every loop, this code should work.