#define ADDR1 0x000000FF #define ADDR2 0x0000FF00
void w_addr1(uint32 addr) { PINSEL0&=0xFFFF0000; IO0DIR=ADDR1; IO0PIN=(IO0PIN&0xFFFFFF00)|addr; }
void w_addr2(uint32 addr) { PINSEL0=0x0000FFFF; IO0DIR=ADDR1; IO0PIN=(IO0PIN&0xFFFF00FF)|(addr<<8); }
int main(void) {
uint32 myaddr1; uint32 myaddr2; myaddr1=0x55; myaddr2=0xaa;
while(1) { w_addr1(myaddr1); w_addr2(myaddr1); } return 0; }
P0.2,P0.3,P0.11,P0.14等接口都加了上拉电阻了(在板子背面将跳线处短接了),在main()的while(1)里,只写一个函数w_addr1(myaddr1)或w_addr2(myaddr1),用示波器看管脚电平都对,如果两个函数一起写有的管脚是个方波,不是高低电平了. w_addr1(myaddr2); w_addr2(myaddr2); P0.14,P0.2,P0.5是方波,其它管脚正常.
w_addr1(myaddr1); w_addr2(myaddr1); P0.3,P0.7,P0.11,P0.4,P0.6是方波,其它管脚正常.
为什么是这样啊??谢谢. |