;
-; portd 3-7 blinken lights ;)
+; portd 3-7 lauflicht mit UART-RX masked byte anzeige
;
-; author: hackbard@hackdaworld.dyndns.org
+; by Hunz ;)
;
.include "../include/2313def.inc"
reti
T1_OVF1:
+; toggle LED
out DDRD, r17
+; next LED
rol r17
+; skip next operation if beyond last LED
sbrs r17, 7
-reti
+reti ; we return if not beyond last LED
+; reset LED counter to first LED
ldi r17, 4
reti
UART_RX:
+; read received byte to r16
in r16, UDR
+; mask with valid LED bits
andi r16, $7C
+; echo masked byte
out UDR, r16
+; set LEDs according to masked byte
out DDRD, r16
reti
INIT:
+; Stackpointer setzen
ldi r16, Low(RAMEND)
out SPL, r16
; baudrate einstellen
ldi r16, 11 ; "38400 bps wert" in r16
out UBRR, r16 ; write to uart baudrate register
+
+; enable TX, RX, Interrupt on RX
ldi r16, ((1<<RXEN)|(1<<TXEN)|(1<<RXCIE))
out UCR, r16
+; PortD Inputs - Enable all LEDs
ldi r16, 0x7C
out DDRD, r16
+; Least Significant LED
ldi r17, 4
+; Timer1 Prescaler: CLK/64 (inc. Timer1 every 64 CLKs)
ldi r16, 3
out TCCR1B, r16
+; Timer1 Overflow Interrupt enable
ldi r16, (1<<TOIE1)
out TIMSK, r16
+; global interrupts enable
sei
+; main loop
MAIN:
rjmp MAIN