关于LED显示屏的问题,非常急用!求大神们指点

2020-01-27 11:44发布

为什么我这个程序只能实现6个字的移动?怎样才能实现18个字移动显示?急死了!非常急用!求指点啊!
#include "reg51.h"
#define OutByte()          RCK = 0;RCK = 1
sbit A1 = P1^1;
sbit B1 = P1^2;
sbit SER = P1^6;
sbit SCK = P1^4;
sbit RCK = P1^5;

unsigned char code Z[480] = {
/*欢   CBBB6 */
0x00,0x80,0x00,0x80,0xFC,0x80,0x04,0xFC,
0x05,0x04,0x49,0x08,0x2A,0x40,0x14,0x40,
0x10,0x40,0x28,0xA0,0x24,0xA0,0x45,0x10,
0x81,0x10,0x02,0x08,0x04,0x04,0x08,0x02,

/*迎   CD3AD */
0x00,0x00,0x20,0x80,0x13,0x3C,0x12,0x24,
0x02,0x24,0x02,0x24,0xF2,0x24,0x12,0x24,
0x12,0x24,0x12,0xB4,0x13,0x28,0x12,0x20,
0x10,0x20,0x28,0x20,0x47,0xFE,0x00,0x00,

/*你   CC4E3 */
0x08,0x80,0x08,0x80,0x08,0x80,0x11,0xFE,
0x11,0x02,0x32,0x04,0x34,0x20,0x50,0x20,
0x91,0x28,0x11,0x24,0x12,0x24,0x12,0x22,
0x14,0x22,0x10,0x20,0x10,0xA0,0x10,0x40,

/*到   CB5BD */
0x00,0x04,0xFF,0x84,0x08,0x04,0x10,0x24,
0x22,0x24,0x41,0x24,0xFF,0xA4,0x08,0xA4,
0x08,0x24,0x08,0x24,0x7F,0x24,0x08,0x24,
0x08,0x04,0x0F,0x84,0xF8,0x14,0x40,0x08,

/*北   CB1B1 */
0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x44,
0x04,0x48,0x7C,0x50,0x04,0x60,0x04,0x40,
0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x42,
0x1C,0x42,0xE4,0x42,0x44,0x3E,0x04,0x00,

/*京   CBEA9 */
0x02,0x00,0x01,0x00,0xFF,0xFE,0x00,0x00,
0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,
0x10,0x10,0x1F,0xF0,0x01,0x00,0x11,0x10,
0x11,0x08,0x21,0x04,0x45,0x04,0x02,0x00,

/*旅   CC2C3 */
0x20,0x80,0x10,0x80,0x10,0xFE,0x01,0x00,
0xFE,0x0C,0x20,0xF0,0x20,0x90,0x3C,0x90,
0x24,0x92,0x24,0x94,0x24,0x88,0x24,0x88,
0x24,0x84,0x44,0xA4,0x54,0xC2,0x88,0x80,

/*游   CD3CE */
0x02,0x10,0x21,0x10,0x11,0x10,0x17,0xBE,
0x82,0x20,0x42,0x40,0x43,0xBC,0x12,0x84,
0x12,0x88,0x22,0x88,0xE2,0xBE,0x22,0x88,
0x24,0x88,0x24,0x88,0x29,0xA8,0x10,0x10,

/*很   CBADC */
0x08,0x00,0x0B,0xF8,0x12,0x08,0x22,0x08,
0x4B,0xF8,0x0A,0x08,0x12,0x08,0x33,0xF8,
0x52,0x44,0x92,0x48,0x12,0x30,0x12,0x20,
0x12,0x10,0x12,0x88,0x13,0x06,0x12,0x00,

/*高   CB8DF */
0x02,0x00,0x01,0x00,0xFF,0xFE,0x00,0x00,
0x0F,0xE0,0x08,0x20,0x08,0x20,0x0F,0xE0,
0x00,0x00,0x7F,0xFC,0x40,0x04,0x4F,0xE4,
0x48,0x24,0x48,0x24,0x4F,0xE4,0x40,0x0C,

/*兴   CD0CB */
0x04,0x08,0x02,0x08,0x21,0x08,0x11,0x10,
0x08,0x10,0x08,0x20,0x00,0x40,0xFF,0xFE,
0x00,0x00,0x04,0x40,0x04,0x20,0x08,0x10,
0x08,0x08,0x10,0x08,0x20,0x04,0x40,0x04,

/*认   CC8CF */
0x00,0x40,0x20,0x40,0x10,0x40,0x10,0x40,
0x00,0x40,0x00,0x40,0xF0,0x40,0x10,0x40,
0x10,0xA0,0x10,0xA0,0x10,0xA0,0x15,0x10,
0x19,0x10,0x12,0x08,0x04,0x04,0x08,0x02,

/*识   CCAB6 */
0x00,0x00,0x20,0x00,0x11,0xFC,0x11,0x04,
0x01,0x04,0x01,0x04,0xF1,0x04,0x11,0x04,
0x11,0xFC,0x11,0x04,0x10,0x00,0x14,0x90,
0x18,0x88,0x11,0x04,0x02,0x02,0x04,0x02,

/*朋   CC5F3 */
0x00,0x00,0x3E,0x7C,0x22,0x44,0x22,0x44,
0x22,0x44,0x3E,0x7C,0x22,0x44,0x22,0x44,
0x22,0x44,0x3E,0x7C,0x22,0x44,0x22,0x44,
0x22,0x44,0x42,0x84,0x4A,0x94,0x85,0x08,

/*友   CD3D1 */
0x02,0x00,0x02,0x00,0x02,0x00,0xFF,0xFE,
0x04,0x00,0x04,0x00,0x0F,0xF0,0x0A,0x10,
0x12,0x10,0x11,0x20,0x21,0x40,0x40,0x80,
0x81,0x40,0x06,0x20,0x18,0x18,0x60,0x06

};
char zi=0;

/*
void OutByte()
{
        RCK = 0;
        RCK = 1;
}         */
void Delay10s()
{
int a,b;
for(a=15;a>0;a--);
{
for(b=123;b>0;b--);
}
}
void DelayMs(int ms)
{
        int i,j;
        for(i=0;i<ms;i++)
        {
                for(j=0;j<100;j++);
        }
}

void LineScan(char line)
{
        switch(line)
        {
                case 0:A1 = 0;B1 = 0;
                break;
                case 1:A1 = 1;B1 = 0;
                break;
                case 2:A1 = 0;B1 = 1;
                break;
                case 3:A1 = 1;B1 = 1;
                break;
                default:
                break;
        }
}

void SendByte(char byte)
{
        char i;
        for(i = 0;i<8;i++)
        {
                if(byte & 0x80)SER = 1;         //1000_0000
                else SER = 0;
                byte = byte <<1;
                SCK = 0;         
                SCK = 1;         //数据提前2指令周期准备好       
        }
}

void initTimer(void)
{
TMOD=0x1;
TH0=0xd8;
TL0=0xf0;
}

void timer0(void) interrupt 1
{
         static char i;
         TH0=0xd8;
         TL0=0xf0;
         i++;
     if(i>=50)
         {          
             i=0;
                 zi++;
                 if(zi>2)zi=0;
     }

}

void main(void)
{
        char i,j,k;
        initTimer();
        TR0=1;
        ET0=1;
        EA=1;
        while(1)
        {
           for(k=0;k<=3;k++)
           {
                   for(j=0;j<=35;j++)
                   {
                      for(i=3;i>=0;i--)
               
                              SendByte(~Z[zi*96+i*8+k*2+(j/2)*32+j%2]);
                          
                   }
                   LineScan(k);
                   OutByte();
                   DelayMs(3);
           }
        }
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。