程序烧录进单片机没反应啊?不知道是不是我的实验板有问题!
追答我再给你个程序,这是我以前写的,因为我没用过单片机,不是很了解。
#include
#include
typedef unsigned char uchar;
typedef unsigned int uint;
uchar code table[] = {0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8};//- 0xbf
void delay(uchar t)
{
uchar i;
while(t--)
{
for(i = 0;i<100;i++);
}
}
void Opertion ()
{
uchar i,j,k,m,n,a,b,c,d;
//显示---1
for(a = 0;a<20;a++)
{
P2 = 0x08;
for(i = 0;i<3;i++)
{
P0 = 0xbf;
delay(10);
P2 = _cror_(P2,1);
}
//P2 = 0x01
P0 = table[0];
delay(10);
}
//显示--12
for(b = 0;b<20;b++)
{
P2 = 0x08;
for(j = 0;j<2;j++)
{
P0 = 0xbf;
delay(10);
P2 = _cror_(P2,1);
}
P2 = 0x02;
for(k = 0;k<2;k++)
{
P0 = table[k];
delay(10);
P2 = _cror_(P2,1);
}
}
//显示-123
for(c = 0;c<20;c++)
{
P2 = 0x08;
P0 = 0xbf;
delay(10);
for(j = 0;j<3;j++)
{
P2 = _cror_(P2,1);
P0 = table[j];
delay(10);
}
}
//显示1234 2345 3456 4567
for(k = 0;k<4;k++)
{
for(d = 0;d<20;d++)
{
P2 = 0x08;
for(m = 0;m<4;m++)
{
P0 = table[k+m];
//P2 = sel;
delay(10);
P2 = _cror_(P2,1);
}
}
}
d = 0;
//显示567-
for(d = 0;d<20;d++)
{
P2 = 0x08;
for(j = 0;j<3;j++)
{
P0 = table[j+4];
//P2 = sel;
delay(10);
P2 = _cror_(P2,1);
}
P0 = 0xbf;
delay(10);
}
d = 0;
//显示67--
for(d = 0;d<20;d++)
{
P2 = 0x08;
for(j = 0;j<2;j++)
{
P0 = table[j+5];
//P2 = sel;
delay(10);
P2 = _cror_(P2,1);
}
for(k = 0;k<2;k++)
{
P0 = 0xbf;
delay(10);
P2 = _cror_(P2,1);
}
}
d = 0;
//显示7---
for(d = 0;d<20;d++)
{
P2 = 0x08;
//P2 = sel;
P0 = table[6];
delay(10);
for(n = 0;n<3;n++)
{
P2 = _cror_(P2,1);
P0 = 0xbf;
delay(10);
}
}
}
void main()
{
while(1)
{
Opertion();
}
}