下面是参照一本书写的
#include
#define Dw 64 //显示区域长度
#define Dh 16 //显示区域高度
#define Lw 64 //LED屏宽度
#define Lh 16 //LED屏高度
#define Sw 16 //扫描宽度
#define EN_ON 1
#define EN_OFF 0
sfr Ctrl_port=0xa0;
sfr Data_port=0x80;
sbit E=P2^5; //显示允许控制端
sbit RCK=P2^6;//锁存信号
sbit SCK=P2^7;//移位信号
unsigned char code Display_Font[64][16]=
{
/*新*/
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x03,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x02,0x03,0x03,0x03, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, 0x03,0x03,0x01,0x03,0x03,0x03,0x03,0x03,
//2
0x03,0x03,0x03,0x03,0x01,0x03,0x01,0x03, 0x03,0x03,0x03,0x01,0x01,0x01,0x03,0x03,
0x03,0x03,0x03,0x03,0x02,0x03,0x03,0x03, 0x03,0x03,0x03,0x03,0x02,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, 0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x03,
//3
0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x03,0x01,0x01,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x02,0x02,0x02,0x02,0x02, 0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x01,0x01,0x01,0x01, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
//4
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, 0x03,0x01,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x02,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x01,0x03,0x01,0x01,0x03,0x01,0x01, 0x01,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
//5
0x03,0x03,0x01,0x03,0x03,0x03,0x01,0x03, 0x03,0x01,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x02,0x03,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x01,0x03,0x01,0x03,0x01,0x03,0x03, 0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x01, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
//6
0x03,0x03,0x03,0x01,0x03,0x01,0x03,0x03, 0x03,0x01,0x03,0x03,0x03,0x01,0x03,0x03,
0x03,0x02,0x03,0x03,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x02,0x03,0x03,0x03,0x03,
0x03,0x01,0x03,0x01,0x03,0x03,0x03,0x03, 0x01,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x01, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
//7
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x03,
0x03,0x03,0x03,0x02,0x02,0x02,0x02,0x02, 0x02,0x02,0x02,0x02,0x02,0x03,0x03,0x03,
0x01,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x01,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x01, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
//8
0x03,0x03,0x03,0x01,0x03,0x01,0x03,0x03, 0x03,0x01,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x02,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x01,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x01, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
//9
0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x03, 0x03,0x01,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x02,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x01,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x01,0x03,0x03,0x03,0x03,0x01, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
//10
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x03,0x01,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x02,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x02,0x03,0x03,
0x03,0x03,0x03,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,
0x03,0x01,0x03,0x03,0x03,0x03,0x03,0x01, 0x03,0x03,0x03,0x03,0x03,0x01,0x03,0x03,
//11
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x03,0x01,0x03,0x03,0x01,0x03,0x03,0x03,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, 0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03, 0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,
//12
0x03,0x03,0x01,0x01,0x03,0x01,0x03,0x03, 0x03,0x01,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x01, 0x03,0x01,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x01,0x03,0x03,0x01, 0x03,0x03,0x01,0x03,0x03,0x03,0x03,0x03,
//13
0x03,0x01,0x03,0x01,0x03,0x03,0x01,0x01, 0x01,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x01, 0x03,0x03,0x01,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x01, 0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x03,
//14
0x01,0x03,0x03,0x01,0x03,0x03,0x03,0x01, 0x01,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x03,0x01,0x03, 0x03,0x03,0x03,0x01,0x01,0x01,0x03,0x03,
0x03,0x03,0x01,0x03,0x03,0x03,0x03,0x01, 0x03,0x03,0x03,0x01,0x01,0x03,0x03,0x03,
//15
0x03,0x01,0x03,0x01,0x03,0x03,0x01,0x03, 0x03,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x03,0x01,0x03,0x03, 0x03,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x01,0x03,0x03,0x03,0x01,0x03,0x01, 0x03,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
//16
0x03,0x03,0x01,0x03,0x03,0x03,0x03,0x03, 0x03,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x01,0x01,0x03,0x03,0x03, 0x03,0x03,0x03,0x03,0x01,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x03, 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03
};
void display(unsigned int XL,unsigned int YL,unsigned int display_count)
{
unsigned char line;
unsigned char col;
unsigned char code *ram_point ;
unsigned int k,ram_begin_addr;
for(k=0;k