#define rGPBCON (*(volatile unsigned long *)0x56000010)
#define rGPBDAT (*(volatile unsigned long *)0x56000014)
#define rGPBUP (*(volatile unsigned long *)0x56000018)
#define GPB5_IN ~(3<<10)
#define GPB6_IN ~(3<<12)
#define GPB7_IN ~(3<<14)
#define GPB8_IN ~(3<<16)
#define GPB5_OUT (1<<10)
#define GPB6_OUT (1<<12)
#define GPB7_OUT (1<<14)
#define GPB8_OUT (1<<16)
#define LED1_ON ~(1<<5)
#define LED2_ON ~(1<<6)
#define LED3_ON ~(1<<7)
#define LED4_ON ~(1<<8)
#define LED1_OFF (1<<5)
#define LED2_OFF (1<<6)
#define LED3_OFF (1<<7)
#define LED4_OFF (1<<8)
void Led_Port_Init(void);
void Delay(int tt);
void main()
{
Led_Port_Init();
rGPBDAT |= (LED1_OFF|LED2_OFF|LED3_OFF|LED4_OFF);
while(1)
{
rGPBDAT = rGPBDAT&(LED1_ON);
Delay(1000);
rGPBDAT = rGPBDAT|((LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF));
Delay(1000);
rGPBDAT = rGPBDAT&(LED2_ON);
Delay(1000);
rGPBDAT = rGPBDAT|((LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF));
Delay(1000);
rGPBDAT = rGPBDAT&(LED3_ON);
Delay(1000);
rGPBDAT = rGPBDAT|((LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF));
Delay(1000);
rGPBDAT = rGPBDAT&(LED4_ON);
Delay(1000);
rGPBDAT = rGPBDAT|((LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF));
Delay(1000);
}
}
void Led_Port_Init(void)
{
rGPBCON &= ~((3<<10)|(3<<12)|(3<<14)|(3<<16));
}
void Delay(int tt)
{
int a,b;
for(a=0;a<=tt;a++)
for(b=0;b<=10000;b++);
}