Program in debug mode work in run mode no
Posted: Fri Mar 03, 2017 6:42 am
This program activate two relays with web interface and real pushbuttons. In debug mode the program works ok but in run mode when i push button with interrupt 14 and button with interrupt 12 the relative relay go on for one second and go off, why?
Code: Select all
memclear
a = 1
b = 1
r1 = 16
r2 = 3
ciclo = 1
dimmer = 0
t1 = 5000
t2 = 5000
bounce = 200
io(po,r1,1)
io(po,r2,1)
interrupt 14,[inta]
interrupt 12,[intb]
interrupt 13,[intc]
interrupt 0,[intd]
interrupt 2,[inte]
interrupt 5,[intf]
[lop]
cls
wprint "Out A (On/Off) "
wprint htmlvar(a)
button "On", [Aon]
button "Off", [Aoff]
wprint "<br><br>"
wprint "Out B (On/Off) "
wprint htmlvar(b)
button "On", [Bon]
button "Off", [Boff]
wprint "<br><br>"
wprint "Out A (Pulse Time) "
wprint htmlvar(t1)
button "On", [PulseAon]
wprint "<br><br>"
wprint "Out B (Pulse Time) "
wprint htmlvar(t2)
button "On", [PulseBon]
wprint "<br><br>"
wprint "Out A and B (Cilic) A "
wprint htmlvar(a)
wprint " B "
wprint htmlvar(b)
button "On", [ciclic]
wprint "<br><br>"
wprint "Dimmer C "
wprint htmlvar(dimmer)
button "On", [dimm]
wprint "<br><br>"
wait
[Aon]
io(po,r1,0)
a = 0
returngui
wait
[Aoff]
io(po,r1,1)
a = 1
returngui
wait
[Bon]
io(po,r2,0)
b = 0
returngui
wait
[Boff]
io(po,r2,1)
b = 1
returngui
wait
[PulseAon]
io(po,r1,0)
delay t1
io(po,r1,1)
returngui
wait
[PulseBon]
io(po,r2,0)
delay t2
io(po,r2,1)
returngui
wait
[ciclic]
if ciclo = 0 then
io(po,r1,1)
a = 1
io(po,r2,1)
b = 1
ciclo = 1
goto [lop]
end if
if ciclo = 1 then
io(po,r1,0)
a = 0
io(po,r2,1)
b = 1
ciclo = 2
goto [lop]
end if
if ciclo = 2 then
io(po,r1,1)
a = 1
io(po,r2,0)
b = 0
ciclo = 3
goto [lop]
end if
if ciclo = 3 then
io(po,r1,0)
a = 0
io(po,r2,0)
b = 0
ciclo = 0
goto [lop]
end if
[inta]
if a=1 then
io(po,r1,0)
a = 0
else
io(po,r1,1)
a = 1
endif
'delay bounce
returngui
wait
[intb]
if b=1 then
io(po,r2,0)
b = 0
else
io(po,r2,1)
b = 1
endif
'delay bounce
returngui
wait
[intc]
wait
[intd]
wait
[inte]
wait
[intf]
wait
[dimm]
wait
end