用单片机制作POV摇摇棒的问题
我手头有一本书《51单片机POV趣味制作详解》,照抄书中内容写了一段摇摇棒的测试程序,但编译失败,Keil提示出错。请C语言高手帮我看一下问题出在哪里?#include<...
我手头有一本书《51单片机POV趣味制作详解》,照抄书中内容写了一段摇摇棒的测试程序,但编译失败,Keil提示出错。请C语言高手帮我看一下问题出在哪里?
#include<reg52.h>
unsigned char led1;
unsigned char led2;
unsigned char code LS[]=
{
0x01,0x00,
0x02,0x00,
0x04,0x00,
0x08,0x00,
0x10,0x00,
0x20,0x00,
0x40,0x00,
0x80,0x00,
0x00,0x01,
0x00,0x02,
0x00,0x04,
0x00,0x08,
0x00,0x10,
0x00,0x20,
0x00,0x40,
0x00,0x80,
}
void delay(unsigned int ms)
{
unsigned int x,y;
for(x=0;x<=ms;x++)
{
for(y=0;y<=110;y++);
}
}
main(void)
{
unsigned char i;
for(;;)
{
for(i=0;i<16;i++)
{
P0=~LS[2*i];
P2=~LS[2*i+1];
delay(10);
}
}
} 展开
#include<reg52.h>
unsigned char led1;
unsigned char led2;
unsigned char code LS[]=
{
0x01,0x00,
0x02,0x00,
0x04,0x00,
0x08,0x00,
0x10,0x00,
0x20,0x00,
0x40,0x00,
0x80,0x00,
0x00,0x01,
0x00,0x02,
0x00,0x04,
0x00,0x08,
0x00,0x10,
0x00,0x20,
0x00,0x40,
0x00,0x80,
}
void delay(unsigned int ms)
{
unsigned int x,y;
for(x=0;x<=ms;x++)
{
for(y=0;y<=110;y++);
}
}
main(void)
{
unsigned char i;
for(;;)
{
for(i=0;i<16;i++)
{
P0=~LS[2*i];
P2=~LS[2*i+1];
delay(10);
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询