CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ pst : "Parallax Serial Terminal" var byte seconde[10], minute[10], uur[10], Foutnummer, vraag byte h, minu, sec long stack1[50], stack2[50] PUB Main | i pst.StartRxTx(31,30,0,115200) cognew(TijdRef, @stack1) cognew(Aanvraag, @stack2) Herzet Hoofdprogramma PUB Hoofdprogramma | gedrukt dira[14]~~ Foutnummer:=0 gedrukt:=0 repeat if ina[9]==1 and gedrukt==0 waitcnt(clkfreq/10 + cnt) gedrukt:=1 if ina[9]==0 and gedrukt==1 uur[Foutnummer]:=h minute[Foutnummer]:=minu seconde[Foutnummer]:=sec pst.Dec(Foutnummer) pst.Str(String(pst#NL,"Tijd is= ")) pst.Dec(uur[Foutnummer]) pst.Str(String(":")) pst.Dec(minute[Foutnummer]) pst.Str(String(":")) pst.Dec(seconde[Foutnummer]) pst.Str(String(" ")) pst.Str(String("FoutN°= ")) Foutnummer:=Foutnummer+1 pst.Dec(Foutnummer) gedrukt:=0 if Foutnummer>6 Foutnummer:=0 pst.clear if Foutnummer>0 waitcnt(clkfreq*1 + cnt) !outa[14] else outa[14]:=0 PUB Aanvraag repeat vraag:=pst.DecIn if vraag==118 Herstart if vraag==120 Lijst vraag:=0 PUB TijdRef sec:=0 repeat waitcnt(clkfreq*1 + cnt) sec:=sec+1 if sec==60 minu:=minu+1 sec:=0 if minu==60 h:=h+1 minu:=0 if h==24 h:=0 if vraag==0 pst.clear pst.Str(String(pst#NL,"Tijd is= ")) pst.Dec(h) pst.Str(String(":")) pst.Dec(minu) pst.Str(String(":")) pst.Dec(sec) pst.home PUB Herstart pst.clear pst.Str(String("Zet juiste tijd")) pst.newline pst.Str(String("Geef uur(xx): ")) h:=pst.DecIn if h>24 Herstart pst.Str(String(pst#NL,"Geef Minute(xx): ")) minu:=pst.DecIn if minu>59 Herstart pst.clear pst.Str(String("De huidige tijd is: ")) pst.Dec(h) pst.Str(String(":")) pst.Dec(minu) pst.Str(String(":")) pst.Dec(sec) return PUB Lijst | i, antwoord pst.clear pst.PositionX(20) pst.Str(String("Foutenlijst is als volgt")) pst.newline pst.PositionX(20) pst.Str(String("________________________")) pst.newline i:=1 if Foutnummer==0 return repeat pst.Str(String(pst#NL,"Tijd is= ")) pst.Dec(uur[i-1]) pst.Str(String(":")) pst.Dec(minute[i-1]) pst.Str(String(":")) pst.Dec(seconde[i-1]) pst.Str(String(" ")) pst.PositionX(20) pst.Str(String("FoutN°= ")) pst.Dec(i) i:=i+1 while i<7 pst.Position(0,9) pst.Str(String("Wenst U de fouten te Resetten?")) antwoord:=pst.CharIn if antwoord=="j" or antwoord=="J" Herzet else pst.clear return PUB Herzet Foutnummer:=1 repeat uur[Foutnummer]:=0 minute[Foutnummer]:=0 seconde[Foutnummer]:=0 Foutnummer:=Foutnummer+1 while Foutnummer<10 Foutnummer:=0 pst.clear return