Following on from an earlier post, to avoid any timing issues I've got this program working from a external 1Hz pulse (200ms on, 800ms off) generated by an 8M2 into Pin.C.3. The program originally "self ran" but 10k resistors from the inputs to 0v cured that and I've also got 100nf decoupling and 470uf. Its the first part part of a larger program on a similar theme.
It runs ok but occasionally seemingly random numbers like 0064, or 1033 etc appear in the display after "Holiday" The second part of the program "Hols Rest" suffers the same problem but the second line, which I dont use, sometimes reads the second line of the bootup sequence www.picaxe.com as well as the numbers in the top line.
Needless to say it runs fine in hours of running in simulation--what have I got wrong?
Thanks
It runs ok but occasionally seemingly random numbers like 0064, or 1033 etc appear in the display after "Holiday" The second part of the program "Hols Rest" suffers the same problem but the second line, which I dont use, sometimes reads the second line of the bootup sequence www.picaxe.com as well as the numbers in the top line.
Needless to say it runs fine in hours of running in simulation--what have I got wrong?
Thanks
Code:
#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.3,C.4,C.5,C.7
input C.0,C.1,C.2,C.3,C.6
'pin 1 = +
'pin 20 = -
Symbol Inner_Sensor = pinC.0 'pin 10
Symbol Outer_Sensor = pinC.1 'pin 9
Symbol Dummy_1Hz = pinc.2 'pin 8
Symbol Clock_In = pinc.3 'pin 7 1Hz input
Symbol Disp_out = pinc.4 'pin 6 DIDNT WORK ???
Symbol Aerate_Sol = B.1 'pin 17
Symbol Pump_Outer_Sol = B.2 'pin 16
Symbol Pump_Inner_Out_sol = B.3 'pin 15
Symbol LED_Hol_Rest = B.4 'pin 14
Symbol LED_Aerate_Rest = B.5 'pin 13
Symbol Led_Spare_Count = B.6 'pin 12
Symbol Air_Pump = B.7 'pin 11
Symbol Timer = w0
Symbol Spare_Count = w3
Symbol Xtra_Aerate = w4
pause 5000
do 'do
Holiday_Mode: '2hrs, 7200secs aerate then 2 hrs settle, repeat infinitum until interuppted by high outer signal from Pin C.1
'Aerate
Timer = 0
serout C.4 , n2400, ( 254,1)
do do
Loop until Clock_In = 1 '1 Hz input
high Aerate_sol, Air_pump
inc Timer
pause 250
if Outer_Sensor = 1 then 'sensor for outer tank, goes high when ready to pump to inner
goto Outer_to_Inner
endif
bintoascii Timer,b23,b24,b25,b26,b27
serout C.4, N2400, (254, 128,b24,b25,b26,b27, " Holiday")
loop until Timer >= 7200 'Timed period
Timer = 0 Spare_Count = 0 'Resets spare counter and others
pause 5000
'Aerate rest 2hrs 7200 secs nothing happening unless sensor on outer goes high.
Timer = 0
serout C.4, n2400, ( 254,1)
do do
low Aerate_Sol, Air_Pump
Loop until Clock_In = 1 '1 hz input
high LED_Hol_Rest 'Puts LED on to say whats happening as no other activity
inc Timer
pause 250
inc Xtra_Aerate 'Xtra Aerate Counting minutes of rest.
bintoascii Timer,b23,b24,b25,b26,b27
serout C.4, N2400, (254, 128,b24,b25,b26,b27, " Hols Rest")
if Outer_Sensor = 1 then
goto Outer_to_Inner
endif
loop until Timer >= 7200 'Timed period
Timer = 0 Xtra_Aerate = 0 low LED_Hol_Rest
loop
Outer_to_Inner: 'Pumping inner to outer now timed