蜂鸣器实验程序 #define GPBCON (*(volatile unsigned *)0x56000010) #define GPBDAT (*(volatile unsigned *)0x56000014) #define GPBUP (*(volatile unsigned *)0x56000018)
void delay(int x) { int k=0xff,j=0xff; while(x) { for(;k>0;k--) for(;j>0;j--) ; x--; } }
int bellMain() { GPBUP &= 0XFFFFFFFE; //上拉使能GPB0 GPBCON &= 0XFFFFFFC; //GPB0设为输出 GPBCON |= 0X0000001; while(1) { GPBDAT &= 0xfe; delay(50); GPBDAT |= 0x01; delay(50); } return (0);
}
红色部分为什么这样定义就不能正常运行(编译通过)
|