//  switchleds.c -- copies input from switches on PORTD to LEDs on PORTB
//  implemented and tested on STK500 with AT90S8515 in rightmost socket
//  Copyleft (!C) 2003 S. Mann and C. Manders,
//  (http://www.gnu.org/copyleft/gpl.html);
//  based on Stephen Lacy's "mirror.c"

//#include <io-avr.h>
#include <avr/io.h>
#include <avr/wdt.h> 

int main(void) {
    unsigned char x; 
    //wdt_disable();
    
    outp (0xFF,DDRB); /* Data Direction Register B;
			 0 means input; 1 means output */
    outp (0x00,DDRD); /* PORTD is all Direction=0 (inputs) */

    outp(0,PORTB);
    while (1) {
	x = inp(PIND);
	outb(x, PORTB);
    }
}

