第二十八课 点阵之四 流动字符
相信如果大家对以前的内容理解的比较好的话,现在的程序对大家来说是轻而易举的了
程序讲解:
/*--------------------------------------------------------------*/
//LED8*8滚动显示
/*--------------------------------------------------------------*/
//包含头文件
#include <reg52.h>
#include "74HC595.H" //第九课有详细讲解
/*--------------------------------------------------------------*/
//代码库 可用软件取(上节课有下载链接)
#define num sizeof(table) //代码长度 还记得 sizeof(table)吗?前面几节课的内容
unsigned char code table[]= {
/*-- 宽度x高度=200x8 --*/
0x00,0x00,0x00,0x00,0x00,
0x00,0x42,0x7E,0x42,0x00,0x00,0x00,0x7E,0x40,0x40,0x00,0x7E,0x42,0x7E,0x00,0x3E,
0x40,0x3E,0x00,0x7E,0x52,0x52,0x00,0x00,0x00,0x0E,0x70,0x0E,0x00,0x7E,0x42,0x7E,
0x00,0x7E,0x40,0x7E,0x00,0x00,0x00,0x42,0x7E,0x40,0x00,0x52,0x52,0x7E,0x00,0x42,
0x7E,0x40,0x18,0x14,0x7E,0x10,0x00,0x1C,0x22,0x44,0x22,0x1C,0x00,0x00,0x3C,0x42,
0x4A,0x62,0x4A,0x42,0x3C,0x00,0x00,0x7E,0x10,0x7E,0x00,0x7C,0x12,0x7C,0x00,0x7E,
0x0A,0x0E,0x00,0x7E,0x0A,0x0E,0x00,0x0E,0x70,0x0E,0x00,0x00,0x00,0x7E,0x04,0x18,
0x20,0x7E,0x00,0x7E,0x52,0x52,0x00,0x3E,0x40,0x7E,0x40,0x3E,0x00,0x00,0x00,0x0E,
0x70,0x0E,0x00,0x7E,0x52,0x52,0x00,0x7C,0x12,0x7C,0x00,0x7E,0x1A,0x6E,0x00,0x00,
0x72,0x52,0x5E,0x00,0x7E,0x42,0x7E,0x00,0x7E,0x42,0x7E,0x00,0x5E,0x52,0x7E,0x00,
0x08,0x08,0x08,0x00,0x7E,0x42,0x7E,0x00,0x72,0x52,0x5E,0x00,0x08,0x08,0x08,0x00,
0x7E,0x42,0x7E,0x00,0x42,0x7E,0x40,0x00,0x00,0x00,0x42,0x7E,0x40,0x00,0x52,0x52,
0x7E,0x00,0x24,0x00,0x18,0x14,0x7E,0x10,0x00,0x5E,0x52,0x7E,0x00,0x00,0x00,0x0C,
0x02,0x4C,0x40,0x4C,0x02,0x0C,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00};
/*--------------------------------------------------------------*/
//延时2000+0us 函数定义
void delay1(void)
{
unsigned char i, j;
for(i = 133; i > 0; i--)
for(j = 6; j > 0; j--);
}
/*--------------------------------------------------------------*/
//主函数
void main (void)
{
unsigned char m, i;
unsigned int n;
while(1)
{
Ser_IN(0x01 << i); //开始列扫描
Ser_IN(~table[i + n]); //查表取出数据
Par_OUT(); //上升沿锁存输出显示
delay1(); //延迟时间
i++; if(i == 8) i = 0; //循环扫描
m++; if(m == 120) {m = 0; n++;} //滚动速度控制
if(n == num-7) n = 0; //循环显示
}
}
本节重点
1、图片字符的显示及循环滚动显示实现的方法
演示视频:
http://v.youku.com/v_show/id_XOTIzNjU1ODg=.html
相关程序:https://static.assets-stash.eet-china.com/album/old-resources/2009/6/3/5429cfb4-a10c-40ea-b0a4-346809c99566.rar
另:利用中断显示的方法:https://static.assets-stash.eet-china.com/album/old-resources/2009/6/3/2d40ed0d-7e01-429f-923d-9eea0f85e113.rar
文章评论(0条评论)
登录后参与讨论