完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
使用74HC595,这是个静态显示的程序,怎么才能让它滚动显示呢,
#include #include ***it SRCLK=P3^6; ***it RCLK=P3^5; ***it SER=P3^4; //--定义要使用的IO口--// #define COMMONPORTS P0 //--列选通控制--// unsigned char code TAB[8] = {0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe}; //--点阵字码--// unsigned char code CHARCODE[18][8]= { {0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00}, //0 {0x00,0x00,0x00,0x00,0x21,0x7f,0x01,0x00}, //1 {0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00}, //2 {0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00}, //3 {0x00,0x00,0x0c,0x14,0x24,0x7f,0x04,0x00}, //4 {0x00,0x00,0x72,0x51,0x51,0x51,0x4e,0x00}, //5 {0x00,0x00,0x3e,0x49,0x49,0x49,0x26,0x00}, //6 {0x00,0x00,0x40,0x40,0x40,0x4f,0x70,0x00}, //7 {0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00}, //8 {0x00,0x00,0x32,0x49,0x49,0x49,0x3e,0x00}, //9 {0x00,0x00,0x7F,0x48,0x48,0x30,0x00,0x00}, //P {0x00,0x00,0x7F,0x48,0x4C,0x73,0x00,0x00}, //R {0x00,0x00,0x7F,0x49,0x49,0x49,0x00,0x00}, //E {0x00,0x00,0x3E,0x41,0x41,0x62,0x00,0x00}, //C {0x00,0x00,0x7F,0x08,0x08,0x7F,0x00,0x00}, //H {0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00}, //I {0x00,0x7F,0x10,0x08,0x04,0x7F,0x00,0x00}, //N {0x7C,0x48,0x48,0xFF,0x48,0x48,0x7C,0x00} //中 }; void delay(unsigned int time) { unsigned int i,j; for(i=0;i for(j=0;j<121;j++); } void Hc595SendByte(unsigned char dat) { unsigned char a; SRCLK=0; RCLK=0; for(a=0;a<8;a++) { SER=dat>>7; dat<<=1; SRCLK=1; _nop_(); _nop_(); SRCLK=0; } RCLK=1; _nop_(); _nop_(); RCLK=0; } void main() { unsigned char tab, j; unsigned int i; while(1) { for(i= 0; i<50; i++ ) //两个字之间的扫描间隔时间 { for(tab=0;tab<8;tab++) { Hc595SendByte(0x00); //消隐 COMMONPORTS = TAB[tab]; //输出字码 Hc595SendByte(CHARCODE[j][tab]); delay(2); } } j++; if(j == 18) { j = 0; } } } |
|
相关推荐
5个回答
|
|
可以把要显示的内容放到一个缓冲区中,然后把其中的内容左移运算,你试试看
|
|
|
|
|
|
|
|
我有个16*16点阵学习板,需要加:176798246详聊
|
|
|
|
|
|
|
|
数字滚动1到4的数字编程
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
【RA-Eco-RA2E1-48PIN-V1.0开发板试用】(第三篇)ADC采集+PWM输出
489 浏览 0 评论
《DNK210使用指南 -CanMV版 V1.0》第四十五章 人脸识别实验
498 浏览 0 评论
655 浏览 0 评论
如何用OpenCV的相机捕捉视频进行人脸检测--基于米尔NXP i.MX93开发板
1329 浏览 0 评论
《DNK210使用指南 -CanMV版 V1.0》第四十章 YOLO2人手检测实验
558 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
11752 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-20 13:35 , Processed in 0.625434 second(s), Total 82, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号