完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
//用AVR点亮32*32LED点阵 点阵里集成74hc595 和74hc138芯片
#include #includetil/delay.h> #include #include #define SI1 PORTC|=(1< 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,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 }; unsigned char scan_date1[32]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}; //行 void delay(unsigned int ms ) { while(ms--) _delay_ms(1); } //初始化函数 void init() { //HC_595初始化 DDRC=0x1F; PORTC=0xFF; //G0() ; //使能HC_595输出使能控制端 //SCK0(); // HC_595移位寄存器时钟输入端口置低电平 //RCK0(); //SCLR0(); //SCLR1(); // HC_595存储寄存器时钟输入 //HC_138初始化 DDRA=0x3F; PORTA=0xFF; } //HC_595列扫描 void HC_595( unsigned int date) { unsigned char i; for(i=0;i<8;i++) { PORTA&=~(1< PORTC|=(1< PORTC&=~(1< date<<=1; PORTC|=(1< PORTC&=~(1< PORTC|=(1< } int main() { init(); unsigned int i=0; unsigned int m=3; unsigned int n=0; for(i=0;i<=31;i++) { PORTA&=~(1< for(n=m-3;n<=m;n++) { if(n<=127) { HC_595(scan_date0[n]); m=m+4; } delay(4); } // OE1(); //关闭HC_138使能 } } |
|
相关推荐
5个回答
|
|
回帖奖励 +1 分积分
你把电路图发一下
|
|
|
|
你写这个程序是32扫的,对速度要求高,静态显示可能还可以,当要移位的话就显示不好了。还有扫描方式可能要改一下,特别是缓存数据好好处理一下,不然你的程序会很麻烦的。建议选择行列式,这样程序比较好处理,32扫的也可以用行列式,分成4列,每列32个字节的数据,缓存可以这样定义BufferData[4][32]
|
|
|
|
好的好的,老师只给了块板子,没有电路图
|
|
|
|
现在亮了,但我只能让它全亮,改了数组数控制不了让哪个灭,好像595进不去呀,麻烦您帮看看呗
|
|
|
|
//用AVR点亮32*32LED点阵 点阵里集成74hc595 和74hc138芯片
#include #include //#include "uart.h" #include #include #define SI1 PORTC|=(1< 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,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 }; unsigned char scan_date1[32]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}; //行 /*unsigned char scan_date0[128]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff }; unsigned char scan_date1[32]={0x1f,0x1e,0x1d,0x1c,0x1b,0x1a,0x19,0x18,0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10, 0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00};*/ void delay(unsigned int us ) { while(us--) _delay_us(1); } //初始化函数 void init() { //HC_595初始化 DDRC=0xFF; PORTC=0xFF; DDRA=0xFF; PORTA=0xFF; } //HC_595列扫描 void HC_595( unsigned int date) { unsigned char i; for(i=0;i<8;i++) { SCK0(); if(date&0x80) PORTC|=(1< PORTC&=~(1< // delay(10); date<<=1; } } int main() { init(); // UART_Config(); G0(); SCLR0() ; SCLR1() ; // unsigned int i=0; // unsigned int m=3; unsigned int n=0; while(1) { for(n=0;n<32;n++) { //OE0(); PORTA&=~(1< HC_595(scan_date0[n*4]); HC_595(scan_date0[n*4+1]); HC_595(scan_date0[n*4+2]); HC_595(scan_date0[n*4+3]); RCK0(); RCK1(); OE1(); delay(10); } // delay (200); } } |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
503 浏览 0 评论
求助一下关于51系列单片机的Timer0的计时问题,TH0、TL0+1的时间是怎么算的?
1756 浏览 1 评论
【RA-Eco-RA4E2-64PIN-V1.0开发板试用】开箱+Keil环境搭建+点灯+点亮OLED
1183 浏览 0 评论
【敏矽微ME32G070开发板免费体验】使用coremark测试敏矽微ME32G070 跑分
1053 浏览 0 评论
【敏矽微ME32G070开发板免费体验】开箱+点灯+点亮OLED
1287 浏览 2 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
12022 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 20:15 , Processed in 0.705192 second(s), Total 79, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号