#include<NXP/iolpc2103.h>
#define INT32U unsigned int
#define DUAN0 1
#define DUAN1 1<<1
#define DUAN2 1<<2
#define DUAN3 1<<3
#define DUAN4 1<<4
#define DUAN5 1<<5
#define DUAN6 1<<6
#define DUAN7 1<<7
#define WEI0 1<<8
#define WEI1 1<<9
#define WEI2 1<<10
#define WEI3 1<<11
void Delay(INT32U num)
{
while(num)
{
num--;
}
}
void main()
{
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;
IODIR = DUAN0|DUAN1|DUAN2|DUAN3|DUAN4|DUAN5|DUAN6|DUAN7|WEI0|WEI1|WEI2|WEI3;
unsigned int TAB[] = {DUAN0|DUAN1|DUAN2|DUAN3|DUAN4|DUAN5,DUAN1|DUAN2,DUAN0|DUAN1|DUAN3|DUAN4|DUAN6,DUAN0|DUAN1|DUAN2|DUAN3|DUAN6};
IOCLR = WEI0|WEI1|WEI2|WEI3;
while(1)
{
int i;
for (i=0;i<4;i++)
{
IOCLR = DUAN0|DUAN1|DUAN2|DUAN3|DUAN4|DUAN5|DUAN6|DUAN7;
Delay(500000);
IOSET = TAB;
Delay(500000);
}
}
}
[img]file:///D:/QQ2011/Users/531187647/Image/76NRW}[)O7TIV@2NWH8F1P5.jpg[/img]
这个仿真结果应该是0,1,2,3循环,但是结果是乱码,0,1,2循环,什么原因啊 |