;ledswich.asm ;4 LEDs on PORTB, 4 switches on PORTD ;PORTD0 SWITCH -----> PORTB0 LED ;PORTD1 SWITCH -----> PORTB1 LED ;PORTD2 SWITCH -----> PORTB2 LED ;PORTD3 SWITCH -----> PORTB3 LED ;Press one or more switches and corresponding LEDs will lightup ;assembled using Atmel's avrasm assembler. ;the following .inc file should be placed in the same directory as ;this assembly program .include "1200def.inc" .cseg .org 0 rjmp RESET ;Reset Handle rjmp RESET rjmp RESET RESET: ldi r16, 0b11111111 ;load register r16 with all 1's out DDRB, r16 ;configure PORT B for all outputs ldi r16, 0b00000000 ;load register r16 with all 0's out DDRD, r16 ;configure PORTD for all inputs loopit: in r16, PIND ;read the state of the pin on PORTD ;into r16 register out PORTB, r16 ;and copy it to PORTB rjmp loopit