📄 74hc595 driver led display.c
字号:
#include <REGX51.H>
#include <INIT.H>
/************汉字点阵*************/
uchar code hanzi[4][32] = //一个汉字分两行,所以数组二维数为字数的两倍
{0x02,0x00,0x01,0x00,0x01,0x00,0xff,0xfe,0x08,0x20,0x08,0x20,0x08,0x20,0x04,0x40,
0x04,0x40,0x02,0x80,0x01,0x00,0x02,0x80,0x04,0x60,0x18,0x1e,0xe0,0x08,0x00,0x00
}, //"文",0
{0x08,0x80,0x0c,0xc0,0x09,0x88,0x12,0x3c,0x17,0xe6,0x31,0x14,0x52,0x08,0x95,0x04,
0x19,0xf8,0x11,0x10,0x12,0x90,0x14,0xa0,0x10,0x60,0x11,0x98,0x16,0x06,0x00,0x00
}, //"俊",1
{00x24,0x04,0x34,0x04,0x24,0x24,0x3f,0xa4,0x44,0x24,0x04,0x24,0x7f,0xa4,0x04,0x24,
0x3f,0xa4,0x24,0xa4,0x24,0xa4,0x24,0xa4,0x24,0x84,0x27,0x84,0x05,0x14,0x04,0x08
}, //"制",2
{0x08,0x80,0x0c,0x80,0x09,0x00,0x13,0xfe,0x12,0x80,0x34,0x88,0x50,0xfc,0x90,0x80,
0x10,0x80,0x10,0x84,0x10,0xfe,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80
} //"作",3
};
/************位定义**************/
sbit STTP = P2^7;
/************变量声明***********/
uint n,i,j; //delay()延时函数计数变量
uint x,y,z; //out_hanzi()
/************函数声明***********/
void delay(uint n); //延时函数
void out_rxd(uchar *d); //汉字输出
/************主函数**************/
void main()
{
SCON = 0x00;
while(1)
{
P1 = 0;
for( x = 0; x < 32; x+=2)
{
STTP = 0;
out_rxd(&hanzi[3][x+1]);
out_rxd(&hanzi[3][x]);
out_rxd(&hanzi[2][x+1]);
out_rxd(&hanzi[2][x]);
out_rxd(&hanzi[1][x+1]);
out_rxd(&hanzi[1][x]);
out_rxd(&hanzi[0][x+1]);
out_rxd(&hanzi[0][x]);
STTP = 1;
P1 = x/2;
}
}
}
/************子函数定义
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -