| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4567 人关注过本帖
标题:头都大了 求大神帮帮忙!
只看楼主 加入收藏
世间未了缘
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2015-5-9
结帖率:0
收藏
已结贴  问题点数:20 回复次数:4 
头都大了 求大神帮帮忙!
显示.zip (24.08 KB)


把下面这个程序导入后   LED灯没亮  

程序代码:
#include<reg51.h>
#include<intrins.h>
 
unsigned char code FONT16x16[3][32]={
{0x08,0x04,0x08,0x7E,0x08,0x44,0x09,0x44,
 0xFF,0xC4,0x08,0x7C,0x08,0x44,0x0A,0x44,
 0x3F,0x44,0x22,0x7C,0x22,0x44,0x22,0x44,
 0x22,0x44,0x3E,0x44,0x22,0x94,0x01,0x08},
{0x00,0x04,0x7F,0xFE,0x40,0x24,0x5F,0xF4, 
 0x41,0x04,0x41,0x04,0x41,0x44,0x4F,0xE4,
 0x41,0x04,0x41,0x44,0x41,0x24,0x41,0x04,
 0x5F,0xF4,0x40,0x04,0x7F,0xFC,0x40,0x04},
{0x00,0x80,0x00,0xA0,0x00,0x90,0x3F,0xFC,
 0x20,0x80,0x3F,0x80,0x24,0x84,0x24,0x44,
 0x3F,0xC8,0x29,0x48,0x31,0x30,0x2A,0x20,
 0x24,0x60,0x4A,0x92,0x91,0x0A,0x02,0x06}
};

sbit  SDI=P2^1;
sbit  SRCLK=P2^2;
sbit  RCLK=P2^2;
#define  LineCtrl P1
   
void delay(unsigned int us)
{   
      while(us--);
}
 
void SendByte(unsigned char dat)
{
    unsigned char i;
    for(i=0;i<8;i++)
    {
        SRCLK=0;
        if(dat&0x80)
    SDI=1;
        else
    SDI=0;
        SRCLK=1;
        dat=dat<<1;
    }
}  
    
void Display(unsigned char *dat1,unsigned char *dat2,unsigned char *dat3)
{
    unsigned char i;
    for(i=0;i<16:i++)
    {   
        SendByte(dat3[2*i+1]);SendByte(dat3[2*i]);
        SendByte(dat2[2*i+1]);SendByte(dat2[2*i]);
        SendByte(dat1[2*i+1]);SendByte(dat1[2*i]);
        RCLK=0;
        _nop_();
        _nop_();
        _nop_();
        _nop_();
        LineCtrl=i;
        RCLK=1;
        delay(100);
    }
}
     
void  main(void)
{ 
    while(1)
    Display(FONT16X16[0],FONT16x16[1],FONT16x16[2]);
}  


单片机新人   求解释一下为什么会这样?
搜索更多相关主题的帖子: include LED灯 
2015-05-09 22:06
海无边
Rank: 2
等 级:论坛游民
帖 子:15
专家分:72
注 册:2011-9-28
收藏
得分:20 
1、去掉FONT16X16中的16X16;
2、for(i=0;i<16:i++) 中:应该为;   

[ 本帖最后由 海无边 于 2015-5-14 00:11 编辑 ]
2015-05-13 23:59
世间未了缘
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2015-5-9
收藏
得分:0 
回复 2楼 海无边
你好,可是改过后还是显示不出汉子哇,你把我的这样改过后能显示出吗?谢谢!
2015-05-14 23:02
笨蛋编程
Rank: 3Rank: 3
等 级:论坛游侠
威 望:4
帖 子:65
专家分:131
注 册:2011-8-11
收藏
得分:0 
程序代码:
#include "reg51.h"
#include "intrins.h"

#define uchar unsigned char
sbit SER = P3^4;
sbit RCK = P3^5;
sbit SCK = P3^6;
uchar code FONT16x16[4][32] = {
        // 交
        0x80,0x00,0x80,0x21,0xFC,0x7F,0x20,0x04,
      0x60,0x08,0x30,0x18,0x18,0x34,0x28,0x7C,
      0x44,0x26,0xC0,0x06,0x80,0x03,0x00,0x03,
      0x80,0x07,0xC0,0x1C,0x30,0xF8,0x0E,0x60,
        // 互
        0x00,0x10,0xFE,0x3F,0x10,0x00,0x10,0x04,
      0xF0,0x0F,0x10,0x04,0x10,0x04,0x10,0x04,
      0x10,0x04,0x08,0x04,0xF8,0x07,0x00,0x04,
      0x00,0x04,0x00,0x24,0xFF,0x7F,0x00,0x00,
        // 性
        0x08,0x02,0x08,0x02,0x48,0x02,0x48,0x12,
      0xDA,0x3F,0x2A,0x02,0x2A,0x02,0x19,0x02,
      0x08,0x0A,0xC8,0x1F,0x08,0x02,0x08,0x02,
      0x08,0x02,0x08,0x22,0xF8,0x7F,0x08,0x00,
        // 的
        0x08,0x02,0x08,0x02,0x44,0x22,0xFE,0x7E,
      0x42,0x21,0xC2,0x20,0x42,0x20,0x42,0x21,
      0x7E,0x26,0x42,0x24,0x42,0x20,0x42,0x20,
      0x42,0x20,0x7E,0x20,0x42,0x14,0x00,0x08,

};
void Delay(uchar delay){
    while(delay --);
}
void SendByte(uchar Byte){
    uchar i;
    for(i=0;i<8;i++){
        SCK = 0;
        if(Byte & (0x80>>i))
            SER = 1;
        else
            SER = 0;
        SCK = 1;
    }
}
void Display(uchar *Code){
    uchar i;
    for(i=0;i<16;i++){
        RCK = 0;
        SendByte(~Code[i*2+1]);
        SendByte(~Code[i*2]);
        if(i<8){
            SendByte(0);
            SendByte(1 << i);
        }else{
            SendByte(1 << i%8);
            SendByte(0);
        }
        RCK = 1;
    }
}
int main(){
    unsigned int i;
    for (i=0;i<400;i++){
        Display(FONT16x16[i/100]);
        Delay(20);
    }
    return 0;
}


[ 本帖最后由 笨蛋编程 于 2015-6-6 07:53 编辑 ]
2015-06-05 19:43
笨蛋编程
Rank: 3Rank: 3
等 级:论坛游侠
威 望:4
帖 子:65
专家分:131
注 册:2011-8-11
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册


[ 本帖最后由 笨蛋编程 于 2015-6-6 07:57 编辑 ]
2015-06-05 19:56
快速回复:头都大了 求大神帮帮忙!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028861 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved