/*--------------------------------------------------------------*/
//列扫描,低电平有效
#include <reg51.h>
/*--------------------------------------------------------------*/
//接口定义
#define L P2 //列
#define R P0 //行
/*--------------------------------------------------------------*/
//代码库
#define num sizeof(table) //代码长度
/*unsigned char code table[]= {
-- 宽度x高度=200x8 -
0x00,0x00,0x00,0x00,
0x7F,0x49,0x49,0x3e,//B
0x00,0x42,0x7E,0x42,//I
0x00,0x7E,0x1A,0x6E,//R
0x00,0x02,0x7E,0x02,//T
0X00,0X7E,0X10,0X7E,//H
0x00,0x7E,0x42,0x24,0x18,0x00,//D
0x7C,0x12,0x7C,0x00,//A
0x0E,0x70,0x0E,0x00,//Y
0x00,0x00,0x00,0x00,0x00,0x00,0x00};
-*/
unsigned char table[]={
0x00,0x1e,0x20,0x40,0x3e,0x40,0x20,0x1e,//W
0x00,0x00,0x7e,0x08,0x08,0x70,0x00,0x00,//H
0x00,0x3c,0x4a,0x4a,0x4a,0x6c,0x00,0x00,//E
0X00,0X00,0X7E,0X04,0X02,0X02,0X7C,0X00,//N
0X00,0X04,0X4E,0X90,0x90,0x7e,0x00,0x00,//Y
0x00,0x3c,0x42,0x42,0x42,0x3c,0x00,0x00,//O
0x00,0x3e,0x40,0x40,0x40,0x3e,0x40,0x00,//U
0X00,0x10,0xfc,0x12,0x12,0x16,0x10,0x00,//F
0x00,0x3c,0x4a,0x4a,0x4a,0x6c,0x00,0x00,//E
0x00,0x3c,0x4a,0x4a,0x4a,0x6c,0x00,0x00,//E
0X00,0X00,0X00,0X7E,0X40,0X00,0X00,0X00,//L
0x04,0x02,0x12,0x24,0x24,0x12,0x02,0x04 //笑脸 };
/*--------------------------------------------------------------*/
//延时5000+0us 函数定义
void delay1(void)
{
unsigned char i, j;
for(i = 185; i > 0; i--)
for(j = 6; j > 0; j--);
}
/*--------------------------------------------------------------*/
//主函数
void main (void)
{
unsigned char i;
unsigned int m, n;
// L= ~(0x01 << i); //开始列扫描
// R= table[i + n]; //查表取出数据
while(1)
{ L= ~(0x01 << i); //开始列扫描
R= table[i + n];
delay1(); //延迟时间
i++; if(i == 8) i = 0; //循环扫描
m++; if(m ==1000) {m = 0; n++;} //滚动速度控制1
if(n == num-7) n = 0; //循环显示
}
}
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |