;JPB Balmoral SBR Controller 25-10-16, 26-10-16, 28-10-16, 30-10-16, 31-10-16
do
#Picaxe 20m2
#No_Data
Disconnect
output B.0,B.1,B.2,B.3,B.4,B.5,B.6,B.7,C.0,C.1,C.2,C.3,C.4,C.5,C.7
input C.1,C.0,C.6
'
Symbol Inner_Sensor = pinC.0 'Goes high to activate
Symbol Outer_Sensor = pinC.1 'Goes high to activate
Symbol Aerate_Sol = B.1
Symbol Pump_Outer_Sol = B.2
Symbol Pump_Inner_Out_sol = B.3
Symbol LED_Hol_Rest = B.4
Symbol LED_Aerate_Rest = B.5
Symbol Led_Spare_Count = B.6
Symbol Air_Pump = B.7
Symbol Aerate_Timer = w0
Symbol Rest_Timer = w1
Symbol Inner_Outer_timer = w2
Symbol Spare_Count = w3
Symbol Xtra_Aerate = w4
Symbol Spare_Counting = w5
Symbol Xtra_Counting = w6
pause 5000
Holiday_Mode: '2hrs aerate then 2 hrs settle, repeat infinitum until interuppted by high outer signal from Pin C.1
'Aerate
do
high Aerate_sol, Air_pump
for Aerate_Timer = 1 to 7200 '120 mins timer
if Outer_Sensor = 1 then 'sensor for outer tank, goes high when ready to pump to inner
goto Outer_to_Inner
endif
pause 1000 'Pause 1 second
next Aerate_Timer
Aerate_Timer = 0 Spare_Count = 0 'Resets spare counter and others
'Aerate rest
low Aerate_Sol, Air_Pump 'Resets
high LED_Hol_Rest 'Puts LED on to say whats happening as no other activity
for Rest_Timer = 1 to 7200 '120 mins timer
inc Xtra_Aerate 'Xtra Aerate Counting minutes of rest.
pause 1000 'Pause 1 sec
if Outer_Sensor = 1 then
goto Outer_to_Inner
endif
next Rest_Timer
Rest_Timer = 0 Xtra_Aerate = 0 low LED_Hol_Rest 'Resets
loop
Outer_to_Inner: 'Pumping inner to outer now timed
'Spare Count
if Spare_count => 1 then 'Spare count. Detects more than 1 outer to inner cycle and puts in extra timed aerate for 1 hr
high Aerate_sol, Air_pump high Led_Spare_Count
low LED_Hol_Rest 'Resets
for Spare_Counting = 1 to 3600 '60 mins timer timer
pause 1000 'Pause 1 sec)
next Spare_Counting
Spare_Counting = 0
endif
'Xtra Aerate
if Xtra_Aerate => 6 then 'Xtra Aerate. Detects more than 60min have passed on Aerate Rest and puts in extra timed aerate for 1 hr
high Aerate_sol, Air_pump high Led_Spare_Count
low LED_Hol_Rest 'Resets
for Xtra_Counting = 1 to 3600 '60 mins timer timer
pause 1000 'Pause 1 second
next Xtra_Counting
Xtra_Aerate = 0 'Resets
endif
'Pump inner to outer
low Aerate_Sol, LED_Hol_Rest, Led_Spare_Count Aerate_Timer = 0 'Resets
high Pump_Outer_Sol, Air_pump
inc Spare_Count
for Inner_Outer_timer = 1 to 3600 '60 mins timer to limit pumping time
if Inner_Sensor = 1 then;
goto Aerate:
endif
pause 1000 'Pause 1 second
next Inner_Outer_timer 'C.7 Sensor stops timer, inner tank full, goes to aerate
low Pump_Outer_Sol Inner_Outer_timer = 0 'Resets
goto Holiday_Mode 'No input from Sensor timer runs to end, back to Holiday_Mode
Aerate:
'Aerate
low Pump_Outer_Sol Inner_Outer_timer = 0 'Aerate 4 hrs settle for 2 hrs everything off then pump out
for Aerate_Timer = 1 to 14400 '240 mins timer
high Aerate_Sol , Air_Pump
pause 1000 'Pause 1 second
next Aerate_Timer
Aerate_timer = 0 'Resets
'Rest
low Aerate_Sol , Air_Pump Aerate_Timer = 0 'Resets
high LED_Aerate_Rest 'Puts LED on to say whats happening as no other activity
for Rest_Timer = 1 to 7200 'wait 120 mins in real time
pause 1000 'Pause 1 second
next Rest_Timer
Rest_Timer = 0 low LED_Aerate_Rest, Pump_Inner_Out_sol 'Resets
Pump_out:
'Pump out until inner sensor = 0
high Pump_Inner_Out_sol, Air_Pump
do
loop until Inner_Sensor = 0
low Pump_Inner_Out_sol, Air_Pump 'Resets
loop