The Man
10.08.2006, 11:17
Hi da,
hier der Quellcode des Weckers. Ich habe nichts gegen Komentare^^
DEFINE stund AS AD[1]
DEFINE minut AS AD[2]
DEFINE bstat AS AD[3]
DEFINE set AS AD[4]
DEFINE waerme AS AD[7]
DEFINE play AS PORT[1]
DEFINE fw AS PORT[2]
DEFINE rep AS PORT[3]
DEFINE dis AS PORT[4]
DEFINE lampe AS PORT[5]'kleiner Out für die LED
DEFINE kugel AS PORT[6]'entspricht der Steckdose
DEFINE kolb AS PORT[8]
DEFINE pumpe AS PORT[7]
DEFINE alts AS BYTE'werden mit SETTIME benutzt
DEFINE altm AS BYTE's = Stunde / m = Minute
DEFINE wstun AS BYTE'Weckstunde und
DEFINE wminu AS BYTE'-minute
DEFINE cycle AS BYTE
DEFINE zzahl AS BYTE
DEFINE zahl AS BYTE
DEFINE mz AS BYTE 'Wert der Einstellungsschleifen
DEFINE heizen AS BYTE
DEFINE heizh AS BYTE
DEFINE merker AS BYTE 'zwei merker nötig, da bei der forward Schleife
DEFINE merker2 AS BYTE'einer runtergezählt wird
DEFINE malt AS BYTE
DEFINE scharf AS BIT'on = wecken / off...
DEFINE nebel AS BIT
DEFINE out AS BIT
DEFINE sda AS PORT[9]
DEFINE scl AS PORT[10]
CONST MINUS=40h
CONST BLANK=20h
CONST DOT=2Eh
CONST Z0=30h
CONST Z1=31h
CONST Z2=32h
CONST Z3=33h
CONST Z4=34h
CONST Z5=35h
CONST Z6=36h
CONST Z7=37h
CONST Z8=38h
CONST Z9=39h
CONST A=41h
CONST B=42h
CONST C=43h
CONST D=44h
CONST E=45h
CONST F=46h
CONST G=47h
CONST H=48h
CONST I=49h
CONST J=4Ah
CONST K=4Bh
CONST L=4Ch
CONST M=4Dh
CONST N=4Eh
CONST O=4Fh
CONST P=50h
CONST Q=51h
CONST R=52h
CONST S=53h
CONST T=54h
CONST U=55h
CONST V=56h
CONST W=57h
CONST X=58h
CONST Y=59h
CONST Z=5Ah
FUNCTION LCD_WRITE(BUF AS BYTE,LCDDATA AS BYTE)
DEFINE EXTPORT BYTEPORT[10]
DEFINE OUTBYTE AS BYTE
'--------- ------WRITE HI NIBBLE ------------------------
OUTBYTE=BUF OR (LCDDATA SHR 4)
EXTPORT=OUTBYTE OR 01000000b
EXTPORT=OUTBYTE AND 10111111b
'--------------- WRITE LO NIBBLE ------------------------
OUTBYTE=BUF OR (LCDDATA AND 0Fh)
EXTPORT=OUTBYTE OR 01000000b
EXTPORT=OUTBYTE AND 10111111b
END FUNCTION
'-----------------------------------------------------
FUNCTION LCD_CLR()
LCD_WRITE(0,02h)
LCD_WRITE(0,01h)
PAUSE 2
END FUNCTION
'----------------------------------------------------
FUNCTION LCD_INIT()
DEFINE EXTPORT BYTEPORT[10]
EXTPORT=0
LCD_WRITE(0, 38h)'0=WRITE CMD
EXTPORT= 00000010b
EXTPORT= 01000010b
EXTPORT= 00000010b
LCD_WRITE(0,28h)
LCD_WRITE(0,0Ch)
LCD_CLR()
END FUNCTION
'----------------------------------------------------
FUNCTION LINE1(POS AS BYTE)
LCD_WRITE(0,7Fh+POS)
END FUNCTION
'----------------------------------------------------
FUNCTION LINE2(POS AS BYTE)
LCD_WRITE(0,BFh+POS)
END FUNCTION
'----------------------------------------------------
FUNCTION clr1 ()
LINE1 (1)
DO
LCD_WRITE (20h, 20h)
cycle = cycle + 1
LOOP UNTIL cycle = 16
cycle = 0
END FUNCTION
FUNCTION clr2 ()
LINE2 (1)
DO
LCD_WRITE (20h, 20h)
cycle = cycle + 1
LOOP UNTIL cycle = 16
cycle = 0
END FUNCTION
FUNCTION rready()
LINE2 (1)
LCD_WRITE (20h, R)
LCD_WRITE (20h, E)
LCD_WRITE (20h, A)
LCD_WRITE (20h, D)
LCD_WRITE (20h, Y)
LCD_WRITE (20h, 2Eh)
LCD_WRITE (20h, T)
LCD_WRITE (20h, O)
LCD_WRITE (20h, 2Eh)
LCD_WRITE (20h, R)
LCD_WRITE (20h, U)
LCD_WRITE (20h, M)
LCD_WRITE (20h, B)
LCD_WRITE (20h, L)
LCD_WRITE (20h, E)
END FUNCTION
FUNCTION ssmooth()
LINE2 (1)
LCD_WRITE (20h, S)
LCD_WRITE (20h, M)
LCD_WRITE (20h, O)
LCD_WRITE (20h, O)
LCD_WRITE (20h, T)
LCD_WRITE (20h, H)
END FUNCTION
FUNCTION nne()
LINE1 (1)
LCD_WRITE (20h, N)
LCD_WRITE (20h, E)
END FUNCTION
FUNCTION oon()
LINE2 (1)
LCD_WRITE (20h, O)
LCD_WRITE (20h, N)
END FUNCTION
FUNCTION ooff()
LINE2 (1)
LCD_WRITE (20h, O)
LCD_WRITE (20h, F)
LCD_WRITE (20h, F)
END FUNCTION
FUNCTION U()
LINE1(1)
LCD_WRITE(20h, U)
LCD_WRITE(20h, H)
LCD_WRITE(20h, R)
LCD_WRITE(20h, Z)
LCD_WRITE(20h, E)
LCD_WRITE(20h, I)
LCD_WRITE(20h, T)
END FUNCTION
FUNCTION WZ()
LINE1(1)
LCD_WRITE(20h, W)
LCD_WRITE(20h, E)
LCD_WRITE(20h, C)
LCD_WRITE(20h, K)
LCD_WRITE(20h, Z)
LCD_WRITE(20h, E)
LCD_WRITE(20h, I)
LCD_WRITE(20h, T)
END FUNCTION
FUNCTION T()
LINE1(1)
LCD_WRITE(20h, T)
LCD_WRITE(20h, I)
LCD_WRITE(20h, T)
LCD_WRITE(20h, E)
LCD_WRITE(20h, L)
END FUNCTION
FUNCTION WE()
LINE1(1)
LCD_WRITE(20h, W)
LCD_WRITE(20h, E)
LCD_WRITE(20h, C)
LCD_WRITE(20h, K)
LCD_WRITE(20h, E)
LCD_WRITE(20h, N)
END FUNCTION
FUNCTION drucken() 'die Funktiion "drucken()"
IF zzahl > 0 THEN zahl = 0 'wird sowohl für Minuten und Stunden
IF zzahl > 9 THEN zahl = 10 'genutzt und mit "LINE2(x)"
IF zzahl > 19 THEN zahl = 20 'auf die Dis-Segmente gesetzt
IF zzahl > 29 THEN zahl = 30 '
IF zzahl > 39 THEN zahl = 40 '
IF zzahl > 49 THEN zahl = 50 'mit den IF-Abfragen werden die zehner-Werte
'von zzahl auf zahl kopiert
'und in SELECT CASE zahl im DIS ausgegeben
SELECT CASE zahl 'also nur eine Ziffer, danach geht der
'Courser zum nächstem Segment
CASE 50 '
LCD_WRITE(20h, 35h)
zzahl = zzahl - 50 'die Subtraktionen sorgen dafür,
'dass von zzahl nur die Einer übrig
CASE 40 'bleiben und in SELECT CASE zzahl
LCD_WRITE(20h, 34h) 'ausgegeben werden
zzahl = zzahl - 40
CASE 30
LCD_WRITE(20h, 33h)
zzahl = zzahl - 30
CASE 20
LCD_WRITE(20h, 32h)
zzahl = zzahl - 20
CASE 10
LCD_WRITE(20h, 31h)
zzahl = zzahl - 10
CASE 0
LCD_WRITE(20h, 30h)
END SELECT
SELECT CASE zzahl
CASE 9
LCD_WRITE(20h, 39h)
CASE 8
LCD_WRITE(20h, 38h)
CASE 7
LCD_WRITE(20h, 37h)
CASE 6
LCD_WRITE(20h, 36h)
CASE 5
LCD_WRITE(20h, 35h)
CASE 4
LCD_WRITE(20h, 34h)
CASE 3
LCD_WRITE(20h, 33h)
CASE 2
LCD_WRITE(20h, 32h)
CASE 1
LCD_WRITE(20h, 31h)
CASE 0
LCD_WRITE(20h, 30h)
END SELECT
zahl = 0
END FUNCTION
wstun = 0
wminu = 0
sda = ON
scl = ON
LCD_INIT()
PAUSE 4
malt = 1
scharf = OFF
#anfang
IF set > 200 THEN
dis = ON
sda = ON
scl = ON
LCD_INIT()
PAUSE 4
mz = 1
DO
IF mz > 5 THEN mz = 1
alts = stund / 11 'P3
altm = minut / 4 'P3
IF mz = 1 THEN
IF (malt < MINUTE) OR (malt > MINUTE) THEN ' verhindert, dass das Dis dauernd aktualisiert wird (flimmert)
U()
LINE2(12)
zzahl = HOUR
drucken()
LCD_WRITE(20h, 20h)
zzahl = MINUTE
malt = MINUTE
drucken()
END IF
TIMER = 0
IF bstat > 200 THEN 'durch den IF Befehl statt WAIT läuft das Prog in einer Schleife,
TIMER = 0 'wodurch die Uhrzeit auf dem Dis aktuallisiert werden kann.
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)'
END IF '
IF TIMER > 25 THEN 'ist Timer < 26, wird die Erhöhung von mz nicht
TIMER = 0 'rückgängig gemacht und die nächste Einstellunsschleife
mz = mz - 1 'angesprochen
DO
IF bstat < 200 THEN out = ON'würde diese Abfrage fehlen, würde man mit bstat = 255 in die DO Schleife gehen,
'was ohne das "out Bit" die Abbruchbedingung sofort erfüllen würde
IF TIMER < 2 THEN
LINE1(1) 'die
U() 'Timerabfragen
END IF 'bewirken
'das blinken
IF TIMER > 25 THEN 'des
clr1() 'Uhrzeit
END IF 'schriftzuges
IF TIMER > 50 THEN TIMER = 0
LINE2(12)
zzahl = stund / 11
alts = zzahl
drucken()
LCD_WRITE(20h, 20h)
zzahl = minut / 4
altm = zzahl
drucken()
SETTIME alts, altm
LOOP UNTIL (bstat > 200) AND (out = ON)
WAIT bstat < 200
END IF
IF mz = 2 THEN
clr2()
malt = 100
END IF
out = OFF
END IF
IF mz = 2 THEN
WZ()
LINE2(12)
zzahl = wstun
drucken()
LCD_WRITE(20h, 20h)
zzahl = wminu
drucken()
TIMER = 0
IF bstat > 200 THEN
TIMER = 0
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)
END IF
IF TIMER > 25 THEN
TIMER = 0
mz = mz - 1
DO
IF bstat < 200 THEN out = ON
IF TIMER < 2 THEN WZ()
IF TIMER > 25 THEN
clr1()
END IF
IF TIMER > 50 THEN TIMER = 0
LINE2(12)
zzahl = stund / 11
wstun = zzahl
drucken()
LCD_WRITE(20h, 20h)
zzahl = minut / 4
wminu = zzahl
drucken()
IF wminu > 4 THEN 'da der Kolben 5 Min
heizen = wminu - 5 'Heizzeit hat, muss
heizh = wstun 'dafür der Zeitpunkt
ELSE 'bestimmt werden
IF wminu = 0 THEN heizen = 55
IF wminu = 1 THEN heizen = 56
IF wminu = 2 THEN heizen = 57
IF wminu = 3 THEN heizen = 58
IF wminu = 4 THEN heizen = 59
heizh = wstun - 1
END IF
LOOP UNTIL (bstat > 200) AND (out = ON)
WAIT bstat < 200
out = OFF
END IF
IF mz = 3 THEN
clr2()
clr1()
END IF
out = OFF
END IF
IF mz = 3 THEN
T()
LINE2(1)
zzahl = merker
drucken()
TIMER = 0
IF bstat > 200 THEN
TIMER = 0
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)
END IF
IF TIMER > 25 THEN
TIMER = 0
mz = mz - 1
DO
IF bstat < 200 THEN out = ON
IF TIMER < 2 THEN
LINE1(1)
T()
END IF
IF TIMER > 25 THEN
clr1()
END IF
IF TIMER > 50 THEN TIMER = 0
LINE2(1)
zzahl = minut / 4
merker = zzahl
drucken()
LOOP UNTIL (bstat > 200) AND (out = ON)
WAIT bstat < 200
END IF
IF mz = 4 THEN clr2()
out = OFF
END IF
IF mz = 4 THEN
WE()
LINE2(1)
IF scharf = ON THEN rready()
IF scharf = OFF THEN ssmooth()
WAIT (bstat > 200) OR (set < 200)'währe bstat > 200 einzigste Bedingung,
'könnte man mz 4 und 5 nicht beenden, ohne
TIMER = 0 'bstat zu betätigen.
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)
IF TIMER > 25 THEN
TIMER = 0
mz = mz - 1
clr2()
IF scharf = ON THEN
scharf = OFF
kolb = scharf
ssmooth()
ELSE
scharf = ON
rready()
END IF
WAIT bstat < 200
END IF
END IF
IF mz = 5 THEN
clr2()
LINE1(1)
LCD_WRITE(20h, N)
LCD_WRITE(20h, E)
LCD_WRITE(20h, B)
LCD_WRITE(20h, E)
LCD_WRITE(20h, L)
IF nebel = ON THEN oon()
IF nebel = OFF THEN ooff()
WAIT (bstat > 200) OR (set < 200)
TIMER = 0
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)
IF TIMER > 25 THEN
TIMER = 0
mz = mz - 1
clr2()
IF nebel = ON THEN
nebel = OFF
kolb = nebel
ooff()
ELSE
nebel = ON
oon()
END IF
WAIT bstat < 200
END IF
IF mz = 6 THEN clr2()
END IF
LOOP UNTIL set < 200
mz = 1
dis = OFF
END IF
IF (nebel = ON) AND (MINUTE = heizen) AND (heizh = HOUR)AND (scharf = ON) THEN kolb = ON
IF (HOUR = wstun) AND (MINUTE = wminu) AND (scharf = ON) THEN
play = ON
PAUSE 11
play = OFF
PAUSE 10
IF merker > 0 THEN
merker2 = merker - 1
DO
fw = ON
PAUSE 10
fw = OFF
PAUSE 10
merker2 = merker2 - 1
LOOP UNTIL merker2 = 0
END IF
rep = ON
PAUSE 10
rep = OFF
PAUSE 10
merker = merker + 1
lampe = ON
kugel = ON
DO
IF (waerme < 105) AND (TIMER > 200) THEN
pumpe = ON
PAUSE 50
pumpe = OFF
TIMER = 0
END IF
IF bstat = 255 THEN
nebel = OFF
lampe = OFF
kugel = OFF
kolb = OFF
WAIT bstat < 255
END IF
LOOP UNTIL kugel = OFF
END IF
GOTO anfang
END
[/code]
hier der Quellcode des Weckers. Ich habe nichts gegen Komentare^^
DEFINE stund AS AD[1]
DEFINE minut AS AD[2]
DEFINE bstat AS AD[3]
DEFINE set AS AD[4]
DEFINE waerme AS AD[7]
DEFINE play AS PORT[1]
DEFINE fw AS PORT[2]
DEFINE rep AS PORT[3]
DEFINE dis AS PORT[4]
DEFINE lampe AS PORT[5]'kleiner Out für die LED
DEFINE kugel AS PORT[6]'entspricht der Steckdose
DEFINE kolb AS PORT[8]
DEFINE pumpe AS PORT[7]
DEFINE alts AS BYTE'werden mit SETTIME benutzt
DEFINE altm AS BYTE's = Stunde / m = Minute
DEFINE wstun AS BYTE'Weckstunde und
DEFINE wminu AS BYTE'-minute
DEFINE cycle AS BYTE
DEFINE zzahl AS BYTE
DEFINE zahl AS BYTE
DEFINE mz AS BYTE 'Wert der Einstellungsschleifen
DEFINE heizen AS BYTE
DEFINE heizh AS BYTE
DEFINE merker AS BYTE 'zwei merker nötig, da bei der forward Schleife
DEFINE merker2 AS BYTE'einer runtergezählt wird
DEFINE malt AS BYTE
DEFINE scharf AS BIT'on = wecken / off...
DEFINE nebel AS BIT
DEFINE out AS BIT
DEFINE sda AS PORT[9]
DEFINE scl AS PORT[10]
CONST MINUS=40h
CONST BLANK=20h
CONST DOT=2Eh
CONST Z0=30h
CONST Z1=31h
CONST Z2=32h
CONST Z3=33h
CONST Z4=34h
CONST Z5=35h
CONST Z6=36h
CONST Z7=37h
CONST Z8=38h
CONST Z9=39h
CONST A=41h
CONST B=42h
CONST C=43h
CONST D=44h
CONST E=45h
CONST F=46h
CONST G=47h
CONST H=48h
CONST I=49h
CONST J=4Ah
CONST K=4Bh
CONST L=4Ch
CONST M=4Dh
CONST N=4Eh
CONST O=4Fh
CONST P=50h
CONST Q=51h
CONST R=52h
CONST S=53h
CONST T=54h
CONST U=55h
CONST V=56h
CONST W=57h
CONST X=58h
CONST Y=59h
CONST Z=5Ah
FUNCTION LCD_WRITE(BUF AS BYTE,LCDDATA AS BYTE)
DEFINE EXTPORT BYTEPORT[10]
DEFINE OUTBYTE AS BYTE
'--------- ------WRITE HI NIBBLE ------------------------
OUTBYTE=BUF OR (LCDDATA SHR 4)
EXTPORT=OUTBYTE OR 01000000b
EXTPORT=OUTBYTE AND 10111111b
'--------------- WRITE LO NIBBLE ------------------------
OUTBYTE=BUF OR (LCDDATA AND 0Fh)
EXTPORT=OUTBYTE OR 01000000b
EXTPORT=OUTBYTE AND 10111111b
END FUNCTION
'-----------------------------------------------------
FUNCTION LCD_CLR()
LCD_WRITE(0,02h)
LCD_WRITE(0,01h)
PAUSE 2
END FUNCTION
'----------------------------------------------------
FUNCTION LCD_INIT()
DEFINE EXTPORT BYTEPORT[10]
EXTPORT=0
LCD_WRITE(0, 38h)'0=WRITE CMD
EXTPORT= 00000010b
EXTPORT= 01000010b
EXTPORT= 00000010b
LCD_WRITE(0,28h)
LCD_WRITE(0,0Ch)
LCD_CLR()
END FUNCTION
'----------------------------------------------------
FUNCTION LINE1(POS AS BYTE)
LCD_WRITE(0,7Fh+POS)
END FUNCTION
'----------------------------------------------------
FUNCTION LINE2(POS AS BYTE)
LCD_WRITE(0,BFh+POS)
END FUNCTION
'----------------------------------------------------
FUNCTION clr1 ()
LINE1 (1)
DO
LCD_WRITE (20h, 20h)
cycle = cycle + 1
LOOP UNTIL cycle = 16
cycle = 0
END FUNCTION
FUNCTION clr2 ()
LINE2 (1)
DO
LCD_WRITE (20h, 20h)
cycle = cycle + 1
LOOP UNTIL cycle = 16
cycle = 0
END FUNCTION
FUNCTION rready()
LINE2 (1)
LCD_WRITE (20h, R)
LCD_WRITE (20h, E)
LCD_WRITE (20h, A)
LCD_WRITE (20h, D)
LCD_WRITE (20h, Y)
LCD_WRITE (20h, 2Eh)
LCD_WRITE (20h, T)
LCD_WRITE (20h, O)
LCD_WRITE (20h, 2Eh)
LCD_WRITE (20h, R)
LCD_WRITE (20h, U)
LCD_WRITE (20h, M)
LCD_WRITE (20h, B)
LCD_WRITE (20h, L)
LCD_WRITE (20h, E)
END FUNCTION
FUNCTION ssmooth()
LINE2 (1)
LCD_WRITE (20h, S)
LCD_WRITE (20h, M)
LCD_WRITE (20h, O)
LCD_WRITE (20h, O)
LCD_WRITE (20h, T)
LCD_WRITE (20h, H)
END FUNCTION
FUNCTION nne()
LINE1 (1)
LCD_WRITE (20h, N)
LCD_WRITE (20h, E)
END FUNCTION
FUNCTION oon()
LINE2 (1)
LCD_WRITE (20h, O)
LCD_WRITE (20h, N)
END FUNCTION
FUNCTION ooff()
LINE2 (1)
LCD_WRITE (20h, O)
LCD_WRITE (20h, F)
LCD_WRITE (20h, F)
END FUNCTION
FUNCTION U()
LINE1(1)
LCD_WRITE(20h, U)
LCD_WRITE(20h, H)
LCD_WRITE(20h, R)
LCD_WRITE(20h, Z)
LCD_WRITE(20h, E)
LCD_WRITE(20h, I)
LCD_WRITE(20h, T)
END FUNCTION
FUNCTION WZ()
LINE1(1)
LCD_WRITE(20h, W)
LCD_WRITE(20h, E)
LCD_WRITE(20h, C)
LCD_WRITE(20h, K)
LCD_WRITE(20h, Z)
LCD_WRITE(20h, E)
LCD_WRITE(20h, I)
LCD_WRITE(20h, T)
END FUNCTION
FUNCTION T()
LINE1(1)
LCD_WRITE(20h, T)
LCD_WRITE(20h, I)
LCD_WRITE(20h, T)
LCD_WRITE(20h, E)
LCD_WRITE(20h, L)
END FUNCTION
FUNCTION WE()
LINE1(1)
LCD_WRITE(20h, W)
LCD_WRITE(20h, E)
LCD_WRITE(20h, C)
LCD_WRITE(20h, K)
LCD_WRITE(20h, E)
LCD_WRITE(20h, N)
END FUNCTION
FUNCTION drucken() 'die Funktiion "drucken()"
IF zzahl > 0 THEN zahl = 0 'wird sowohl für Minuten und Stunden
IF zzahl > 9 THEN zahl = 10 'genutzt und mit "LINE2(x)"
IF zzahl > 19 THEN zahl = 20 'auf die Dis-Segmente gesetzt
IF zzahl > 29 THEN zahl = 30 '
IF zzahl > 39 THEN zahl = 40 '
IF zzahl > 49 THEN zahl = 50 'mit den IF-Abfragen werden die zehner-Werte
'von zzahl auf zahl kopiert
'und in SELECT CASE zahl im DIS ausgegeben
SELECT CASE zahl 'also nur eine Ziffer, danach geht der
'Courser zum nächstem Segment
CASE 50 '
LCD_WRITE(20h, 35h)
zzahl = zzahl - 50 'die Subtraktionen sorgen dafür,
'dass von zzahl nur die Einer übrig
CASE 40 'bleiben und in SELECT CASE zzahl
LCD_WRITE(20h, 34h) 'ausgegeben werden
zzahl = zzahl - 40
CASE 30
LCD_WRITE(20h, 33h)
zzahl = zzahl - 30
CASE 20
LCD_WRITE(20h, 32h)
zzahl = zzahl - 20
CASE 10
LCD_WRITE(20h, 31h)
zzahl = zzahl - 10
CASE 0
LCD_WRITE(20h, 30h)
END SELECT
SELECT CASE zzahl
CASE 9
LCD_WRITE(20h, 39h)
CASE 8
LCD_WRITE(20h, 38h)
CASE 7
LCD_WRITE(20h, 37h)
CASE 6
LCD_WRITE(20h, 36h)
CASE 5
LCD_WRITE(20h, 35h)
CASE 4
LCD_WRITE(20h, 34h)
CASE 3
LCD_WRITE(20h, 33h)
CASE 2
LCD_WRITE(20h, 32h)
CASE 1
LCD_WRITE(20h, 31h)
CASE 0
LCD_WRITE(20h, 30h)
END SELECT
zahl = 0
END FUNCTION
wstun = 0
wminu = 0
sda = ON
scl = ON
LCD_INIT()
PAUSE 4
malt = 1
scharf = OFF
#anfang
IF set > 200 THEN
dis = ON
sda = ON
scl = ON
LCD_INIT()
PAUSE 4
mz = 1
DO
IF mz > 5 THEN mz = 1
alts = stund / 11 'P3
altm = minut / 4 'P3
IF mz = 1 THEN
IF (malt < MINUTE) OR (malt > MINUTE) THEN ' verhindert, dass das Dis dauernd aktualisiert wird (flimmert)
U()
LINE2(12)
zzahl = HOUR
drucken()
LCD_WRITE(20h, 20h)
zzahl = MINUTE
malt = MINUTE
drucken()
END IF
TIMER = 0
IF bstat > 200 THEN 'durch den IF Befehl statt WAIT läuft das Prog in einer Schleife,
TIMER = 0 'wodurch die Uhrzeit auf dem Dis aktuallisiert werden kann.
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)'
END IF '
IF TIMER > 25 THEN 'ist Timer < 26, wird die Erhöhung von mz nicht
TIMER = 0 'rückgängig gemacht und die nächste Einstellunsschleife
mz = mz - 1 'angesprochen
DO
IF bstat < 200 THEN out = ON'würde diese Abfrage fehlen, würde man mit bstat = 255 in die DO Schleife gehen,
'was ohne das "out Bit" die Abbruchbedingung sofort erfüllen würde
IF TIMER < 2 THEN
LINE1(1) 'die
U() 'Timerabfragen
END IF 'bewirken
'das blinken
IF TIMER > 25 THEN 'des
clr1() 'Uhrzeit
END IF 'schriftzuges
IF TIMER > 50 THEN TIMER = 0
LINE2(12)
zzahl = stund / 11
alts = zzahl
drucken()
LCD_WRITE(20h, 20h)
zzahl = minut / 4
altm = zzahl
drucken()
SETTIME alts, altm
LOOP UNTIL (bstat > 200) AND (out = ON)
WAIT bstat < 200
END IF
IF mz = 2 THEN
clr2()
malt = 100
END IF
out = OFF
END IF
IF mz = 2 THEN
WZ()
LINE2(12)
zzahl = wstun
drucken()
LCD_WRITE(20h, 20h)
zzahl = wminu
drucken()
TIMER = 0
IF bstat > 200 THEN
TIMER = 0
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)
END IF
IF TIMER > 25 THEN
TIMER = 0
mz = mz - 1
DO
IF bstat < 200 THEN out = ON
IF TIMER < 2 THEN WZ()
IF TIMER > 25 THEN
clr1()
END IF
IF TIMER > 50 THEN TIMER = 0
LINE2(12)
zzahl = stund / 11
wstun = zzahl
drucken()
LCD_WRITE(20h, 20h)
zzahl = minut / 4
wminu = zzahl
drucken()
IF wminu > 4 THEN 'da der Kolben 5 Min
heizen = wminu - 5 'Heizzeit hat, muss
heizh = wstun 'dafür der Zeitpunkt
ELSE 'bestimmt werden
IF wminu = 0 THEN heizen = 55
IF wminu = 1 THEN heizen = 56
IF wminu = 2 THEN heizen = 57
IF wminu = 3 THEN heizen = 58
IF wminu = 4 THEN heizen = 59
heizh = wstun - 1
END IF
LOOP UNTIL (bstat > 200) AND (out = ON)
WAIT bstat < 200
out = OFF
END IF
IF mz = 3 THEN
clr2()
clr1()
END IF
out = OFF
END IF
IF mz = 3 THEN
T()
LINE2(1)
zzahl = merker
drucken()
TIMER = 0
IF bstat > 200 THEN
TIMER = 0
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)
END IF
IF TIMER > 25 THEN
TIMER = 0
mz = mz - 1
DO
IF bstat < 200 THEN out = ON
IF TIMER < 2 THEN
LINE1(1)
T()
END IF
IF TIMER > 25 THEN
clr1()
END IF
IF TIMER > 50 THEN TIMER = 0
LINE2(1)
zzahl = minut / 4
merker = zzahl
drucken()
LOOP UNTIL (bstat > 200) AND (out = ON)
WAIT bstat < 200
END IF
IF mz = 4 THEN clr2()
out = OFF
END IF
IF mz = 4 THEN
WE()
LINE2(1)
IF scharf = ON THEN rready()
IF scharf = OFF THEN ssmooth()
WAIT (bstat > 200) OR (set < 200)'währe bstat > 200 einzigste Bedingung,
'könnte man mz 4 und 5 nicht beenden, ohne
TIMER = 0 'bstat zu betätigen.
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)
IF TIMER > 25 THEN
TIMER = 0
mz = mz - 1
clr2()
IF scharf = ON THEN
scharf = OFF
kolb = scharf
ssmooth()
ELSE
scharf = ON
rready()
END IF
WAIT bstat < 200
END IF
END IF
IF mz = 5 THEN
clr2()
LINE1(1)
LCD_WRITE(20h, N)
LCD_WRITE(20h, E)
LCD_WRITE(20h, B)
LCD_WRITE(20h, E)
LCD_WRITE(20h, L)
IF nebel = ON THEN oon()
IF nebel = OFF THEN ooff()
WAIT (bstat > 200) OR (set < 200)
TIMER = 0
mz = mz + 1
WAIT (bstat < 200) OR (TIMER > 25)
IF TIMER > 25 THEN
TIMER = 0
mz = mz - 1
clr2()
IF nebel = ON THEN
nebel = OFF
kolb = nebel
ooff()
ELSE
nebel = ON
oon()
END IF
WAIT bstat < 200
END IF
IF mz = 6 THEN clr2()
END IF
LOOP UNTIL set < 200
mz = 1
dis = OFF
END IF
IF (nebel = ON) AND (MINUTE = heizen) AND (heizh = HOUR)AND (scharf = ON) THEN kolb = ON
IF (HOUR = wstun) AND (MINUTE = wminu) AND (scharf = ON) THEN
play = ON
PAUSE 11
play = OFF
PAUSE 10
IF merker > 0 THEN
merker2 = merker - 1
DO
fw = ON
PAUSE 10
fw = OFF
PAUSE 10
merker2 = merker2 - 1
LOOP UNTIL merker2 = 0
END IF
rep = ON
PAUSE 10
rep = OFF
PAUSE 10
merker = merker + 1
lampe = ON
kugel = ON
DO
IF (waerme < 105) AND (TIMER > 200) THEN
pumpe = ON
PAUSE 50
pumpe = OFF
TIMER = 0
END IF
IF bstat = 255 THEN
nebel = OFF
lampe = OFF
kugel = OFF
kolb = OFF
WAIT bstat < 255
END IF
LOOP UNTIL kugel = OFF
END IF
GOTO anfang
END
[/code]