1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
#include 《reg51.h》
#include 《intrins.h》//要用到 _nop_() #define uint unsigned int #define uchar unsigned char ***it SH_595=P2^1; ***it DATA_595=P2^0; ***it ST_CP_595=P2^2;//74HC595(12)-ST_CP上升沿-移位寄存器的数据进入数据存储寄存器 输出锁存器的时钟信号端口 ***it MR_595=P2^3; //74HC595(10)-MR 为0将移位寄存器的数据清0 ***it E1_154=P2^4;//74HC154(18)-E1为0开列(col)输出 显示允许 控制信号端口 uchar keynum; uchar tempbmp[64]; uint base=0; //在bmp地址中移动,从0 到 rows - 15,每次加2,实现移动效果 uint tmp=0; uint col=0; unsigned char code bmp1[]={ //字模表 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x08,0x00,0x08,0x1F,0xC8,0x92,0x48,0x52,0x48,0x32,0x48,0x12,0x48,0x1F,0xFF, 0x12,0x48,0x32,0x48,0x52,0x48,0x92,0x48,0x1F,0xC8,0x00,0x08,0x00,0x08,0x00,0x00,/*“单”,0*/ 0x00,0x00,0x00,0x01,0x00,0x06,0x7F,0xF8,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40, 0x04,0x40,0xFC,0x40,0x04,0x7F,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,/*“片”,1*/ 0x08,0x20,0x08,0xC0,0x0B,0x00,0xFF,0xFF,0x09,0x00,0x08,0xC1,0x00,0x06,0x7F,0xF8, 0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0xFC,0x00,0x02,0x00,0x02,0x00,0x1E,0x00,0x00,/*“机”,2*/ 0x02,0x00,0x02,0x00,0x42,0x00,0x33,0xFC,0x00,0x09,0x02,0x11,0x05,0x02,0x79,0xC2, 0x41,0x34,0x41,0x08,0x41,0x14,0x79,0x62,0x05,0x82,0x04,0x01,0x04,0x01,0x00,0x00,/*“设”,3*/ 0x02,0x00,0x02,0x00,0x42,0x00,0x33,0xFE,0x00,0x04,0x02,0x08,0x02,0x00,0x02,0x00, 0x02,0x00,0xFF,0xFF,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,/*“计”,4*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; void delayXms(uchar ms) // 延时毫秒@12M,ms最大值255 { uchar i; while(ms--) for(i = 0;i《10;i++); } void SendByte(uchar a) // { uchar byte,i; byte=a; for(i=0;i《8;i++) { SH_595=0; if(byte&0X80) DATA_595=1; else DATA_595=0; SH_595=1; byte《《=1; } } void sendbmp(uchar *bmp,uint rows) { for(base=0;base《=rows-64;base=base+2)// 左移动 { for(tmp=0;tmp《5;tmp++) //每个字块显示5次 { for(col=0;col《16;col++) { E1_154=0; //为0,允许显示 MR_595=0; //清理行输出,将移位寄存器的数据清0 MR_595=1; ST_CP_595=0; //上升沿 ST_CP_595=1; // base=64; SendByte(bmp[base+col*2]); // 实际上595是输出 行数据分为第一个字上半屏,下半屏 第二个字上下半屏 SendByte(bmp[base+col*2+1]); P1=col; //列控制 ST_CP_595=0; //上升沿 ST_CP_595=1; delayXms(7); //显示2ms } } } } void main() { //列选线 MR_595=1; E1_154=1; while(1) { sendbmp(&bmp1,sizeof(bmp1));//显示第2次字 } } |
|
|
|
只有小组成员才能发言,加入小组>>
2565 浏览 0 评论
763浏览 1评论
524浏览 0评论
276浏览 0评论
458浏览 0评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-30 22:43 , Processed in 1.536483 second(s), Total 78, Slave 60 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号