.def temp1 = r16 .def temp2 = r17 .def temp3 = r18 .def temp4 = r19 ;Zähler LS Einfahrt EG .def temp5 = r20 ;Zähler LS Einfahrt OG .def temp6 = r21 ;Zähler LS Ausfahrt EG .def temp7 = r22 ;Zähler LS Ausfahrt OG .def temp8 = r23 ;BelegungEG .def temp9 = r24 ;BelegungOG .def temp10=r25 .equ XTAL=4000000 ldi temp8, 0 ; Anfansstatus ldi temp9, 0 rcall ausw Main: sbic PINC, PINC0 ; 4 taster werden abgefragt rcall EinfEGp1 sbic PINC, PINC1 rcall AusfEGp1 sbic PINC, PINC2 rcall EinfOGp1 sbic PINC, PINC3 rcall AusfOGp1 rjmp Main ausw: rcall AuswertungEG0to7 ; bei der auswertung wird jeweils das rcall AuswertungEG8to14 register des EG und das des OG rcall AuswertungEG15to20 auf gleichheit mit einer konstanten geprüft und dann ins jeweilige ausgabeporogramm gespungen rcall AuswertungOG0to7 wenn gleich rcall AuswertungOG8to14 rcall AuswertungOG15to20 EinfEGp1: ldi temp4, 0 ;zähler für jede lichtschranke, und es wird die belegung aufgerufen rcall tast1 bei erdgeschoss plus bzw minus 1 subi temp4, -1 bei obergeschoss einfahrt =erdgeschoss rcall BelegEGp1 minus 1 und obergeschoss plus 1, ret bei ausfahrt umgekehrt AusfEGp1: ldi temp5, 0 rcall tast2 subi temp5, -1 rcall BelegEGm1 ret EinfOGp1: ldi temp6, 0 rcall tast3 subi temp6, -1 rcall BelegEGm1 rcall BelegOGp1 ret AusfOGp1: ldi temp7, 0 subi temp7, -1 rcall tast4 rcall BelegEGp1 rcall BelegOGm1 ret tast1: sbis PINC, PINC0 :entrellen rjmp tast1 rcall delay5ms rcall delay5ms rcall msr16 tast11: sbic PINC, PINC0 rjmp tast11 rcall msr16 ret tast2: sbis PINC, PINC1 rjmp tast2 rcall delay5ms rcall delay5ms rcall msr16 tast21: sbic PINC, PINC1 rjmp tast21 rcall msr16 ret tast3: sbis PINC, PINC2 rjmp tast3 rcall delay5ms rcall delay5ms rcall msr16 tast31: sbic PINC, PINC2 rjmp tast31 rcall msr16 ret tast4: sbis PINC, PINC3 rjmp tast4 rcall delay5ms rcall delay5ms rcall msr16 tast41: sbic PINC, PINC3 rjmp tast41 rcall msr16 ret msr16: tst temp1 breq msr16b push temp1 msr16a: rcall ms1 dec temp1 brne msr16a pop temp1 msr16b: ret ms1: push r24 push r25 ldi r24,LOW(XTAL/4000) ldi r25,HIGH(XTAL/4000) ms1a: sbiw r24,1 brne ms1a nop pop temp3 pop temp2 ret ret BelegEGp1: subi temp8, -1 rcall ausw ret BelegEGm1: subi temp8, 1 rcall ausw ret BelegOGp1: subi temp9, -1 rcall ausw ret BelegOGm1: subi temp9, 1 rcall ausw ret