完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
嵌入式(飞思卡尔)LED16个8x8灯管 求帮忙看下哪里有问题,我自己写了,但是只显示4个,如果我把 第3个 循环的值改成16,字就会乱。
static void LED_phy_display(uint8 data) { /* 每个小LED板每行有8个LED灯 */ uint8 i; for(i=0;i<8;i++) { if((data>>7)&0x01) { /*输出低电平*/ led_R1_PutVal(NULL, 0); } else { /*输出高电平*/ led_R1_PutVal(NULL, 1); } /*SCLK输出高电平*/ led_CLK_PutVal(NULL, 1); /*移除已经处理的最高位*/ data<<= 1; /*SCLK输出低电平*/ led_CLK_PutVal(NULL, 0); } } static void led_destroy(uint8 rowNumber ) { for(int i=0; i<8;i++) { LED_phy_display(0x00); } /* 片选 */ led_EN_PutVal(NULL, 1); /* 锁存列信号,高电平有效 */ led_STB_PutVal(NULL, 1); led_STB_PutVal(NULL, 0); /* 行信号选择 */ select_row(rowNumber); /* 片选 */ led_EN_PutVal(NULL, 0); } 清空部分 void LED_display_init(void) { /*行选择清零*/ led_select_row_PutVal(NULL, 0x00); /*片选清零*/ led_EN_PutVal(NULL, 0); /*锁存置1*/ led_STB_PutVal(NULL, 1); /*CLK清零*/ led_CLK_PutVal(NULL, 0); } 数组部分 uint8 power_on0[24][16]={ {0x00,0x00,0xFC,0x04,0x05,0x49,0x2A,0x14,0x10,0x28,0x24,0x45,0x81,0x02,0x04,0x08}, {0x80,0x80,0x80,0xFC,0x04,0x08,0x40,0x40,0x40,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02}, /* (16 X 16 , 新宋体 )*/ {0x00,0x20,0x13,0x12,0x02,0x02,0xF2,0x12,0x12,0x12,0x13,0x12,0x10,0x28,0x47,0x00}, {0x00,0x80,0x3C,0x24,0x24,0x24,0x24,0x24,0x24,0xB4,0x28,0x20,0x20,0x20,0xFE,0x00}, /* (16 X 16 , 新宋体 )*/ {0x10,0x10,0x1F,0x20,0x20,0x67,0x64,0xA4,0x27,0x20,0x22,0x21,0x20,0x21,0x22,0x2C}, {0x40,0x40,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x40,0x40,0x40,0x80,0x40,0x30,0x0E}, /* (16 X 16 , 新宋体 )*/ {0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x41,0x41,0x80}, {0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0x28,0x10}, /* (16 X 16 , 新宋体 )*/ {0x1F,0x00,0x00,0x01,0x79,0x0F,0x09,0x11,0x17,0x21,0x21,0x4F,0x81,0x01,0x05,0x02}, {0xE0,0x40,0x80,0x04,0x28,0xF0,0x20,0x10,0xD0,0x08,0x08,0xE4,0x02,0x00,0x00,0x00}, /* (16 X 16 , 新宋体 )*/ {0x00,0x7F,0x41,0x7F,0x41,0x7F,0x08,0xFF,0x00,0x7F,0x41,0x7F,0x08,0x49,0x88,0x18}, {0x00,0x04,0x04,0x08,0x10,0x22,0x02,0xC4,0x08,0x10,0x22,0x02,0x04,0x08,0x90,0x60}, /* (16 X 16 , 新宋体 )*/ {0x08,0x1D,0xF0,0x10,0x10,0xFD,0x10,0x38,0x34,0x50,0x53,0x90,0x10,0x10,0x10,0x10}, {0x10,0x10,0x90,0x90,0x10,0x10,0x90,0x90,0x10,0x1E,0xF0,0x10,0x10,0x10,0x10,0x10}, /* (16 X 16 , 新宋体 )*/ {0x10,0x10,0x10,0x13,0xFC,0x10,0x10,0x15,0x18,0x30,0xD0,0x10,0x10,0x10,0x51,0x26}, {0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06}, {0x08,0x04,0x00,0x7F,0x01,0x3F,0x02,0xFF,0x04,0x08,0x34,0xC4,0x04,0x08,0x10,0x20}, {0x20,0x40,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x40,0x20,0x58,0x46,0x40,0x40,0x40,0x40}, /* (16 X 16 , 新宋体 )*/ {0x00,0xFC,0x23,0x20,0x20,0x3D,0x45,0x45,0x65,0x95,0x09,0x09,0x11,0x21,0x47,0x80}, {0x20,0x20,0xFE,0x20,0x20,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x04,0xFE,0x00}, /* (16 X 16 , 新宋体 )*/ {0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44,0x44,0x44,0x4E,0xF0,0x01,0x02}, {0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10}, /* (16 X 16 , 新宋体 )*/ {0x00,0x00,0x3F,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x05,0x02}, {0x10,0xF8,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00} }; 循环取出 void PowerOnDisplay(void) { int i,rowNumber,columnNumber; for(i=0;i<200;i++) //200表示显示的时间长度 { /* 以行为单位,循环 */ for( rowNumber=0; rowNumber /* 选择某一块 */ //就是这里 for( columnNumber=0; columnNumber<8; columnNumber++) { /* 以块为单位,写入列信号数据 */ LED_phy_display( power_on0[columnNumber][rowNumber]); } /* 片选 */ led_EN_PutVal(NULL, 1); /* 锁存列信号,高电平有效 */ led_STB_PutVal(NULL, 1); led_STB_PutVal(NULL, 0); /* 行信号选择 */ select_row(rowNumber); /* 片选 */ led_EN_PutVal(NULL, 0); } led_destroy( rowNumber ); delay_ms(0.5); } } main 方法里面我是直接: while(1){ 清空的方法 循环显示文字的方法 } |
|
相关推荐
4个回答
|
|
LEDRowNum 这个是 24 第三个循环改成了 16 也不行
|
|
|
|
评分 |
|
|
|
|
|
|
|
我的问题解决了,是出现半个字半个字的卡出来的,感谢楼上!第一次发帖有点小激动
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
298 浏览 1 评论
《DNESP32S3使用指南-IDF版_V1.6》第二十六章 INFRARED_RECEPTION实验
309 浏览 0 评论
826 浏览 0 评论
求助一下关于51系列单片机的Timer0的计时问题,TH0、TL0+1的时间是怎么算的?
1911 浏览 2 评论
【RA-Eco-RA4E2-64PIN-V1.0开发板试用】开箱+Keil环境搭建+点灯+点亮OLED
1427 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
12032 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 13:02 , Processed in 0.673551 second(s), Total 83, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号