|
Thanks... heres what I did
Thanks everyone for your speedy replies. I'll post what I did so that anyone else with a similar question or whoever is curious can see the program.
After posting I went into the stamp editor and created a test program. I checked back today for the answers and then double checked my program. I finally ended with...
in the Declare Variables Section
longpump Var word 'pneumatic pump delay
in the Initialize Inputs & Outputs Section
longpump = 870
Below the PWM Output Section I created a new Pnuematic Pump Delay Section In it read:
longpump = longpump + 1
if rc_sw1 = 0 then nopump
if p4_sw_aux1 = 1 then pumpon 'pump turns on when pneumatics fired
if p4_sw_aux2 = 1 then pumpon 'pump turns on when pneumatics fired
if longpump < 900 then waitpump
if longpump > 799 then pumpon
nopump:
longpump = 0
waitpump:
relay6_fwd = 0
relay6_rev = 0
goto pumpdone
pumpon:
longpump = 810
relay6_fwd = 1
relay6_rev = 0
pumpdone:
Since the delay was so long I added a feature that would automatically turn the pump on whenever I fired the cylinders. FYI our system only leaks about 3psi every 20-30 seconds which is why I needed such a large delay.. I may make it even larger.
My old code for anyone interested used variable coun and pump (both bytes) and read
'coun = coun + 1
'if rc_sw1 = 0 then pump_off
'if coun < 220 then pump_off2
'if coun < 250 then pump_on
'pump_off:
'coun = 0
'pump = 0
'pump_off2:
'relay6_fwd = 0
'relay6_rev = 0
'goto nextstep
'pump_on:
'pump = pump + 1
'if coun < 235 then extr1
'coun = coun - 1
'extr1:
'if pump < 220 then nextstep
'relay6_fwd = 1
'relay6_rev = 0
'coun = coun - 1
'pump = pump - 1
'nextstep:
(of course without the ' marks). It took the same amount of variable space but gave a much smaller maximum pump delay (only 11 seconds as set up, max of roughly 15-20 seconds)
__________________
One Team, One Bot, One Fleet of Ambulances!
|