SPLProgramm1: rcall Anschlußkontrolle rcall Timeron rcall LPWMon ldi temp,0 sts 0xA3,temp ;DP-Marker ldi temp,1 sts 0xA0,temp ;Rücksprung vom Timer ldi temp,20 sts 0xA1,temp ;20 sec-DP-Zeit ldi temp,18 sts 0xA2,temp ;18 sec-Takt Stromsumme lds temp,0x60 ;Ladestrom in PWM eingeben lds temp1,0x61 out OCR1BH,temp1 out OCR1BL,temp ldi temp,0b00001000 ;PinB5 ausschalten,PB3 einschalten out PortB,temp sei ;Interrupt möglich SPLProgramm2: ldi temp,low (RAMEND) ;Stackpointer initialisieren out SPL, temp ldi temp,high (RAMEND) ;Stackpointer initialisieren out SPH, temp rcall LStrommessung rcall NCVMessung rcall Kontrolle12V lds temp,0xA2 subi temp,18 breq Stromsumme1 lds temp,0xA1 subi temp,20 breq DPkontrolle1 lds temp,0xB0 subi temp,60 breq LStromwahl2 lds temp,0xB1 subi temp,120 breq LStromwahl3 lds temp,0xB2 subi temp,12 breq LStromwahl4 lds temp,0xB3 subi temp,13 breq LStromwahl5 lds temp,0xB4 subi temp,14 breq LStromwahl6 sbis Pind,6 rjmp Spezialladenneu rjmp SPLProgramm2 LPWMon: ldi temp,0b10100011 out TCCR1A,temp ldi temp,0b00000001 out TCCR1B,temp ret Timeron: ;Timerinitialisierung ldi temp, 0b00000101 ;Timer 0 auf CK 1024 einstellen out TCCR0, temp ldi temp, 150 ;Timer 0 auf 150 einstellen out TCNT0, temp ldi temp, 0b00000001 ;Timer 0 Interrupt initialisieren out TIMSK, temp ldi temp,74 ;74 für 1 sec-Takt in 93 schreiben sts 0x93,temp ldi temp,0 ;Zeitspeicher auf 0 einstellen sts 0x94,temp ;94 und 95 für Sekunden sts 0x95,temp sts 0x96,temp ;96 und 97 für Minuten sts 0x97,temp sts 0x98,temp ;98 und 99 für Stunden sts 0x99,temp ret Timer: in temp,sreg ; Statusregister sichern push temp ldi temp, 150 ; Timer 0 auf 150 einstellen out TCNT0, temp ;****************************************************************************** ;Hier kommt das Timerprogramm hin ;****************************************************************************** lds temp1,0x93 ; Zählregister auf 74 eingestellt,= 1 sec Takt dec temp1 breq Sekunden sts 0x93,temp1 ; Zählregister abspeichern ;****************************************************************************** out sreg,temp pop temp ; Statusregister zurück laden reti ; zurück ins Hauptprogramm und Interrupt ; zurücksetzen Sekunden: sts 0x93,temp1 ; Zählregister abspeichern out sreg,temp ; Statusregister zurückladen pop temp ldi temp1,74 ; Zählregister wieder mit 74 laden sts 0x93,temp1 lds r30,0x94 ;Sekundenspeicher laden lds r31,0x95 adiw r30,1 ;um 1 erhöhen sts 0x94,r30 ;neuen Sekundenwert abspeichern sts 0x95,r31 lds r30,0x94 lds r31,0x95 subi r30,60 breq Minuten1 ;weiter zu Minuten, wenn 60 sek erreicht sind lds temp,0xA1 inc temp sts 0xA1,temp lds temp3,0xA2 inc temp3 sts 0xA2,temp3 lds temp3,0xB0 inc temp3 sts 0xB0,temp3 lds temp3,0xB1 inc temp3 sts 0xB1,temp3 rjmp Hauptlcd minuten1: rjmp minuten Minuten: ldi temp,0 sts 0x94,temp ;Sekunden auf 0 stellen sts 0x95,temp lds r30,0x96 ;Minutenspeicher laden lds r31,0x97 adiw r30,1 ;Minutenspeicher um 1 erhöhen sts 0x96,r30 ;neuen Minutenwert abspeichern sts 0x97,r31 subi r30,60 ;60 abziehen breq Stunden ;weiter zu Stunden, wenn 60 min erreicht sind lds temp3,0xB2 inc temp3 sts 0xB2,temp3 lds temp3,0xB3 inc temp3 sts 0xB3,temp3 lds temp3,0xB4 inc temp3 sts 0xB4,temp3 rjmp Hauptlcd Stunden: ldi temp,0 sts 0x96,temp ;Minuten auf 0 stellen sts 0x97,temp lds r30,0x98 ;Stundenspeicher laden lds r31,0x99 adiw r30,1 ;Stundenspeicher um 1 erhöhen sts 0x98,r30 ;neuen Stundenwert abspeichern sts 0x99,r31 rjmp Hauptlcd ;zur Anzeige