#include"2440addr.h"
void timer0_init(void);
void led_init(void);
int Main()
{
unsigned int temp=0;
timer0_init();
led_init();
rGPBDAT&=~(1<<5);
while(1)
{
if(rSRCPND&(1<<10))
{
temp=~temp;
rSRCPND|=(1<<10);
}
if(temp==1)
{
rGPBDAT&=~(1<<5);
}
else
{
rGPBDAT|=(1<<5);
}
}
return 0;
}
void led_init()
{
rGPBCON&=~(3<<10);
rGPBCON|=(1<<10);
rGPBUP&=~(1<<5);
}
void timer0_init()
{
rTCFG0&=~(0xff);
rTCFG0|=99;
rTCFG1&=~(0xf);
rTCFG1|=0x02;
rTCNTB0=62500;
rTCON|=(1<<1);
rTCON|=0x09;
}
|