setfreq m8
pause 1000
serout c.4,t9600,("System Reset",cr,lf)
pause 3000
main:
serout c.4,t9600, ("sending data!",cr,lf)
serin [2000], c.7,t9600, ("dat"),b1
if b1 = "a" then step1
goto main
step1:
serout c.4,t9600,("ok",cr,lf)
pause 2000
b1=0
serout c.4,t9600, ("awaiting command",cr,lf)
serin [60000],c.7,t9600,b8
if b8="1" then main
if b8="2" then shutdown
if b8="3" then planb
if b8="4" then planc
if b8="5" then pland
if b8="6" then plane
if b8="7" then planf
if b8="8" then plang
if b8="9" then reset
endif
goto main
shutdown:
serout c.4,t9600, ("system will now shut down",cr,lf)
pause 3000
goto waiting
planb:
serout c.4,t9600, ("now in plan B mode",cr,lf)
pause 3000
bmain:
serout c.4,t9600, ("sending *B* data",cr,lf)
serin [1000], c.7,t9600, ("dat"),b1
if b1 = "a" then step1
goto bmain
planc:
serout c.4,t9600, ("now in plan C mode",cr,lf)
pause 3000
cmain:
serout c.4,t9600, ("sending *C* data",cr,lf)
serin [1000], c.7,t9600, ("dat"),b1
if b1 = "a" then step1
goto cmain
pland:
serout c.4,t9600, ("now in plan D mode",cr,lf)
pause 3000
dmain:
serout c.4,t9600, ("sending *D* data",cr,lf)
serin [1000], c.7,t9600, ("dat"),b1
if b1 = "a" then step1
goto dmain
plane:
serout c.4,t9600, ("now in plan E mode",cr,lf)
pause 3000
emain:
serout c.4,t9600, ("sending *E* data",cr,lf)
serin [1000], c.7,t9600, ("dat"),b1
if b1 = "a" then step1
goto emain
planf:
serout c.4,t9600, ("now in plan F mode",cr,lf)
fmain:
serout c.4,t9600, ("sending *F* data",cr,lf)
serin [1000], c.7,t9600, ("dat"),b1
if b1 = "a" then step1
goto fmain
plang:
serout c.4,t9600, ("now in plan G mode",cr,lf)
gmain:
serout c.4,t9600, ("sending *G* data",cr,lf)
serin [1000], c.7,t9600, ("dat"),b1
if b1 = "a" then step1
goto gmain
waiting:
b8=0
serout c.4,t9600, ("System is Shut Down",cr,lf)
serout c.4,t9600, ("awaiting command",cr,lf)
serin [60000],c.7,t9600,b8
if b8="1" then main
if b8="2" then shutdown
if b8="3" then planb
if b8="4" then planc
if b8="5" then pland
if b8="6" then plane
if b8="7" then planf
if b8="8" then plang
if b8="9" then reset
endif
goto waiting