|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
用ATMEGA8做的LED电子显示屏,但程序是51的
怎么把它改过来,求教高手!!
这是51的程序
# include<reg51.h>
# define BLDN 2
Sbit G = 0x97;
Sbit RCLK =0x96;
Sbit SCLR = 0x95;
Void delay(unsigned int);
Unsigned char data dispram[32];
/*---------------------------
主函数void main(void)
----------------------------*/
Void main(void)
{
Unsigned char code Bmp[][32]={
{
0FEH,0FFH,0FEH,0FFH,0FEH,0FFH,0C0H,007H,0DEH,0F7H,0DEH,0F7H,0C0H,007H,0DEH,0F7H
0DEH,0F7H,0DEH,0F7H,0C0H,007H,0DEH,0F7H,0FEH,0FDH,0FEH,0FDH,0FFH,001H,0FFH,0FFH
}
{
0FFH,0FFH,0C0H,00FH,0FFH,0DFH,0FFH,0BFH,0FFH,07FH,0FEH,0FFH,0FEH,0FFH,0FEH,0FBH
000H,001H,0FEH,0FFH,0FEH,0FFH,0FEH,0FFH,0FEH,0FFH,0FEH,0FFH,0FAH,0FFH,0FDH,0FFH
}
};
Register unsigned char I,j,k,l;
SCON=0x00;
TMOD=0x01;
P1=0x3f;
IE=0x82;
While(1)
{
delay(2000);
for(i=0;i<32;i++)
{
despram=Bmp[5];
if(i%2)delay(100);
}
Delay(3000);
for(i=0;i<6;i++)
{
for(j=0;j<16;j++)
{
for(k=0;k<15;k++)
{
dispram[k*BLKN]=Bmp[j*BLKN];
dispram[k*BLKN+1]=Bmp[j*BLKN+1];
}
dispram[30]=Bmp[j*BLKN];
dispram[31]=Bmp[j*BLKN+1];
delay(100);
}
}
delay(3000);
for(i=0;i<6;i++)
{
For(j=0;j<2;j++)
For(k=1;k<9;k++)
{
For(l=0;l<16;l++)
{
Dispram[l*BLKN]=dispram[l*BLKN]<<1|dispram[l*BLKN+1]<<7;
Dispram[l*BLKN+1]=dispram[l*BLKN+1]<<1|Bmp[l*BLKN+j]>>(8-k);
}
Delay(100);
}//end(k=0;k<16;k++)
}end for(i=0;i<6;i++)
Delay(3000)
For(i=0;i<32;i++)
{dispram=0x00;
If(i%2)delay(100);
}
}//end while(1)
}
/*延时函数*/
Void delay(unsigned int dt)
{
Register unsigned char bt;
For(bt=0;bt<255;bt++);
}
/*显示屏扫描(定时器T0中断)函数*/
Void leddisplay(void) interrupt 1 using 1
{
Register unsigned char I,j=BLKN;
TH0=oxF8;
TL0=Ox30;
I=P1;
I=++i&0x0f;
Do{
j--;
SBUF=dispram[i*BLKN+J];
WHILE(! TI);TI=0;
}while(j);
G=1;
P1 &=0xf0;
RCLK=1; |
|