Gast
#161026
Hallo Ich möchte in einer schleife contl inc und es auf dem LCD ausgeben. Der Code funktioniert aber nur das er bis 10 auf dem LCD zählt und dann wieder auf eins springt???? Ist nur ein code auszug!!! (ASM ATmega8 inc ist eingebunden) za: ldi temp, 48 ldi comp, 0 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 ;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 ldi temp1,1 +'0' DIGIT4: dec temp1 subi countl, low (-1000) ; sbci counth, high(-1000) brcs DIGIT4 cp temp1,temp in temp2,sreg sbrs temp2,1 set in temp2,sreg sbrc temp2,6 rcall lcd_data ; rcall pause ldi temp1, -10 +'0' ;zweite stelle hinterm Komma DIGIT3: inc temp1 subi countl, low(100) sbci counth, high(100) brcc DIGIT3 cp temp1,comp in temp2,sreg sbrs temp2,1 set in temp2,sreg sbrc temp2,6 rcall lcd_data rcall pause ldi temp1, 10 +'0' ; dritte stelle hinterm Komma DIGIT2: dec temp1 subi countl, -10 brcs DIGIT2 cp temp1,comp in temp2,sreg sbrs temp2,1 set in temp2,sreg sbrc temp2,6 rcall lcd_data rcall pause DIGIT1: mov temp1, countl ;vierte stelle hinterm Komma subi temp1,-48 cp temp1,comp in temp2,sreg sbrs temp2,1 set in temp2,sreg sbrc temp2,6 rcall lcd_data rcall pause rjmp za