.include"m8def.inc" .def temp = R16 .def temp1 = R17 .def temp2 = R18 .def temp3 = R19 .def countl = r20 .def counth = r21 .def temp4 = r22 .def comp = r23 .def verg = r24 ldi temp, low(ramend) out SPl, temp ldi temp, High(ramend) out sph, temp ldi countl, 0b00000000 ldi counth, 0b00000000 ldi temp, 0xFF out DDRD, temp ldi temp, 0x00 out DDRB, temp rcall lcd_init rcall lcd_clear ldi temp, 48 ldi comp, 0 za: rcall lcd_clear inc countl inc counth clt ;T-Flag löschen ldi temp1, -1 + '0' ;temp1 für ASCII Ausgabe initialisiern; DIGIT5: inc temp1 ;temp1 Register subi countl, low (10000) ;Subtrahiere 10000 vom 16bit Wert >> Digit 5 des ASCII Zeichens sbci counth, high(10000) brcc DIGIT5 cpse temp1, temp set brtc e ;Schleife solange bis Wert negativ ;cp temp1,temp ;beide Register vergleichen wenn ungleich wird Zero Flag gelöscht ;in temp2,sreg ;Statusregister Laden ;sbrs temp2,1 ;Überspring nächsten Befehl wenn Z-Flag gesetzt ;set ;Setze T-Flag ;in temp2,sreg ;Staturegister nachladen ;sbrc temp2,6 ;Überspringe nächsten Befehl wenn T-Flag gelöscht rcall lcd_data ;Seriell ausgeben rcall pause rcall pause e: ldi temp1,10 +'0' DIGIT4: dec temp1 subi countl, low (-1000) ; sbci counth, high(-1000) brcs DIGIT4 cpse temp1, temp set brtc d ;cp temp1,temp ;in temp2,sreg ;sbrs temp2,1 ;set ;in temp2,sreg ;sbrc temp2,6 rcall lcd_data ; rcall pause rcall pause d: ldi temp1, -1 +'0' ;zweite stelle hinterm Komma DIGIT3: inc temp1 subi countl, low(100) sbci counth, high(100) brcc DIGIT3 cpse temp1, temp set brtc c ;cp temp1,comp ;in temp2,sreg ;sbrs temp2,1 ;set ;in temp2,sreg ;sbrc temp2,6 push temp push temp1 push temp2 rcall lcd_data rcall pause rcall pause c: ldi temp1, 10 +'0' ; dritte stelle hinterm Komma DIGIT2: dec temp1 subi countl, -10 brcs DIGIT2 cpse temp1, temp set brtc a ;cp temp1,comp ;in temp2,sreg ;sbrs temp2,1 ;set ;in temp2,sreg ;breq temp2,6 rcall lcd_data rcall pause rcall pause a: DIGIT1: mov temp1, countl ;vierte stelle hinterm Komma subi temp1,-48 cpse temp1, temp set brtc b ;cp temp1,comp ;in temp2,sreg ;sbrs temp2,1 ;set ;in temp2,sreg ;sbrc temp2,6 rcall lcd_data rcall pause b: rjmp za