/*AT91SAM7X256 registers used*/
#define PIO_PER				 (*((volatile unsigned int *)0xFFFFF400))
#define PIO_OER 			 (*((volatile unsigned int *)0xFFFFF410))
#define PIO_SODR			 (*((volatile unsigned int *)0xFFFFF430))
#define PIO_CODR			 (*((volatile unsigned int *)0xFFFFF434))

void Delay (void);

void Delay(void)
{
	int count = 1000000;
	/* waste time */
	while (count){
		count = count -1;
	}
}

int main (void)
{
	/* configure PIO line for gree LED */
	 PIO_PER = 0x00000038; 			/*enable uC pin (RXD1) as PIO */
	 PIO_OER = 0x00000038;			/*enable uC pin (RXD1) as output */

	/* configure PIO line for red LED */
	// PIO_PER = 0x00000001;			/*enable uC pin(RXD0) as PIO */
	 //PIO_OER = 0x00000001;			/*enable uC pin(RXD0) as PIO */

	/* configure PIO line for yellow LED */
	 //PIO_PER = 0x00000002;			/*enable uC pin(TXD0) as PIO */
	 //PIO_OER = 0x00000002;			/*enable uC pin(TXD0) as PIO */
	 while (1){
		 	 PIO_CODR = 0x00000020;  //with clear output data register the green led is turned off
		 	 PIO_SODR = 0x00000020;	//with set output data register the green led is turned on
		 	 Delay();
		 	 PIO_CODR = 0x00000010; //with clear output data register the red led is turned off
		 	 PIO_SODR = 0x00000010; //with set output data register the red led is turned on
		 	 Delay();
		 	 PIO_CODR = 0x00000008; //with clear output data register the yellow led is turned off
		 	 PIO_CODR = 0x00000008; //with set output data register the yellow led is turned on
		 	 Delay();

	 }


}
