;******************************************************** ;* * ;* Pinbelegung * ;* A0 = D0 = PB0 * ;* A1 = D1 = PB1 * ;* A2 = D2 = PB2 * ;* A3 = D3 = PB3 * ;* notRD = PC0 * ;* notWR = PC1 * ;* ALE = PC2 * ;* * ;******************************************************** .include "4433def.inc" .def temp=r16 .def const=r17 .equ RD=0 .equ WR=1 .equ ALE=2 reset: ldi temp, RAMEND ;Stackpointer initialisieren out spl,temp sbi ucsrb,txen ;Transmit enable ldi temp,(4000000/(9600*16))-1 ;Baudrate einstellen out ubrr,temp ldi const,$30 ;BCD nach Ascii ldi temp,$FF ;Port C ist Ausgang out DDRC,temp ldi temp,$03 ;RD und WR high(negative Logik) out PORTC,temp loop: ldi temp,$FF ;PORTB Ausgang out DDRB,temp ldi temp,$00 ;Adresse anlegen out PORTB,temp sbi PORTC,ALE cbi PORTC,ALE ldi temp,$00 ;PORTB Eingang out DDRB,temp ;ausser RD und WR cbi PORTC,RD ;RD auf low in temp,PINB ;einlesen sbi PORTC,RD ;RD wieder auf high andi temp,0b00001111 ;Bits maskieren add temp,const ;BCD nach Ascii rcall serout ;Steuerzeichen ausgeben ldi temp,10 rcall serout ldi temp,13 rcall serout rjmp loop serout: sbis ucsra,udre rjmp serout out udr,temp ret