下面是个点阵教程能流动,我在protues仿真不能流动,并且显示的字也不对?请教了
#include <reg51.h>
char XD[ ]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x60};
char code YD[] ={
0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7,
0xb7,0xab,0xa9,0x81,0xab,0xab, 0xab,0xbf,
0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7,
0xf7, 0x81, 0xb7, 0x83, 0x97, 0x83, 0xb7, 0xb7};
void delay(int x) {
int i,j;
for(i=0;i<x;i++)
for(j=0;j<120;j++);
}
main()
{
int i,t,k=0;
while(1)
{
for(t=0;t<10;t++)
{
for(i=0;i<8;i++)
{
P2=XD;
P0=YD[k+1];
delay(2);
}
}
k=k+1;
if(k>24) k=0;
}
}
|