#define MP0_4CON (*(vola
tile unsigned long *)0xE0200340)
#define MP0_4DAT (*(volatile unsigned long *)0xE0200344)
#define GPD0CON (*(volatile unsigned long *)0xE02000A0)
#define GPD0DAT (*(volatile unsigned long *)0xE02000A4)
static void Delay(long count)
{
volatile int i, j = 0;
volatile static int loop = 800000000/10000;
for(;count > 0;count--)
for(i=0;i < loop; i++) { j++; }
}
void main(void)
{
GPD0CON &= ~(0xF << 0);
GPD0CON |= 1<<0;//设置为输出
MP0_4CON= (MP0_4CON & ~0xFFFF0000) | 0x11110000; //设置高四位为输出
MP0_4DAT|= 0xF0;//关闭led
while(1)
{
GPD0DAT |= 1<<0;//打开蜂鸣
Delay(400000);
GPD0DAT &= ~(1<<0);//关闭蜂鸣
Delay(400000);
}
}