
/*@Title:    AVR-GCC test program for at90s2313
    Author:   eto
    Mail-to:  esoc@sfc.keio.ac.jp
    Date:     4/2001
    Purpose:  SW on LED
    Software: AVR-GCC  needed
    Hardware: ATS90S2313 

    PortD LED and PortB SW

    PB0=SW0
    PD3=LED0

*/

#include <io2313.h>
#include <iomacros.h>
typedef unsigned char  io8bit;

int main( void )
	{
	io8bit nowled ;

	outp(0xff,DDRD);			/* PD1-PD6 PortD for output */
	outp(0xfe,DDRB);			/* PB0-PB1 PortB for input  */

	nowled = 0x00;				/* LED init all Low         */

	for (;;)
		{
		if((inp(PINB) & 0x01) != 0x00)	 	/* check switch    */
			nowled = 0x01;			/* LED0 on set     */
		else
			nowled = 0x00;			/* LED off set     */

		outp(nowled, PORTD);			/* LED out         */
		}
	}


