;+----------------------------------------------------------------------
;| Titel		: Beispiel IN/OUT für das myAVR-Board
;+----------------------------------------------------------------------
;| Funktion 	: Solange Taster 1 gedrückt ist, wird eine LED
;|				: eingeschaltet.
;| Schaltung	: PORTD2=Taster1, PORTB0=LED-Rot
;+----------------------------------------------------------------------
;| Prozessor	: ATmega8
;| Takt		: 3,6864 MHz
;| Sprache		: Assembler
;| Datum		: 05.06.2004
;| Version		: 1.5
;| Autor		: Dipl. Ing. Päd. Alexander Huwaldt
;+----------------------------------------------------------------------
.include	"AVR.H"
;------------------------------------------------------------------------
;Reset and Interrupt vector             ;VNr.  Beschreibung
	rjmp	main	;1     POWER ON RESET
	reti		;2     Int0-Interrupt
	reti		;3     Int1-Interrupt
	reti		;4     TC2 Compare Match
	reti		;5     TC2 Overflow
	reti		;6     TC1 Capture
	reti		;7     TC1 Compare Match A
	reti		;8     TC1 Compare Match B
	reti		;9     TC1 Overflow
	reti		;10    TC0 Overflow
	reti		;11    SPI, STC Serial Transfer Complete
	reti		;12    UART Rx Complete
	reti		;13    UART Data Register Empty
	reti		;14    UART Tx Complete
	reti		;15    ADC Conversion Complete
	reti		;16    EEPROM Ready
	reti		;17    Analog Comparator
	reti		;18    TWI (I²C) Serial Interface
	reti		;19    Store Program Memory Ready
;------------------------------------------------------------------------
;Start, Power ON, Reset
main:	ldi	r16,hi8(RAMEND)
	out	SPH,r16
	ldi	r16,lo8(RAMEND)	;Stack Initialisierung
	out	SPL,r16	;Init Stackpointer
	cbi	DDRD,2	;PORTD2 auf Eingang
	sbi	PORTD,2	;PORTD2 Pullup
	sbi	DDRB,0	;PORTB0 auf Ausgang
;------------------------------------------------------------------------
mainloop:	cbi	PORTB,0	;Wert bei Taste nicht gedrückt
	sbis	PIND,2	;Tatse auswerten
	sbi	PORTB,0	;LED an
	rjmp	mainloop
;------------------------------------------------------------------------

