找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4466|回复: 1
打印 上一主题 下一主题
收起左侧

关于LED点阵程序non-address/-constant initializer报错的问题

[复制链接]
跳转到指定楼层
楼主
ID:111517 发表于 2017-7-7 08:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
这是一个LED16*16程序,我想让LED点阵移屏显示温度,*ss是定义的需要显示字符指针数组,问题出现在这个字符指针数组中的tempint_one,我想把它设定成指向显示一个温度数据的数组指针,这个指针最后指向谁完全由温度数据通过另一个tabnum指针数组控制,但是问题出现在ss在定义及初始化总是报错:main.c(55): error C247: non-address/-constant initializer ,问题现在出在tempint_one,但是现在该怎么初始化它才可以解决这个问题?相关代码及报错如下,程序未完成,不相关代码没上,勿怪!
PS:1、ss在函数外初始化也一样
     2   在ss中去掉tempint_one就没有报错

----------------------------------------------------------字模定义文件------------------------------------------------------

#ifndef __FONT_H__
#define __FONT_H__
#include<basic.h>

// ------------------  汉字字模的数据结构定义 ------------------------ //
uchr code tabspace[]={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};
uchr code tabdong[]={0x22,0x00,0x22,0x80,0x2A,0xA0,0xAA,0xAF,0xAA,0xAA,0xAF,0xAA,0xAA,0xAA,0xFA,0xFF,
      0xAA,0xAA,0xAF,0xAA,0xAA,0xAA,0xEA,0xAF,0xAA,0xA0,0x23,0x80,0x22,0x00,0x00,0x00};
uchr code tabli[]={0x40,0x00,0x44,0x10,0x44,0x08,0x44,0x06,0xC4,0x01,0xFE,0xFF,0x42,0x01,0x63,0x02,
      0x42,0x06,0x00,0x00,0xF8,0x0F,0x00,0x40,0x00,0x80,0xFF,0x7F,0x00,0x00,0x00,0x00};
uchr code tabqiang[]={0x02,0x20,0xE2,0x43,0x22,0x82,0x22,0x42,0x7F,0x3E,0x02,0x00,0x80,0x4F,0xBE,0x44,
      0x92,0x44,0x92,0x44,0xF2,0x7F,0x92,0x44,0x92,0x44,0xBF,0x64,0x82,0xCF,0x00,0x00};
uchr code tabqiang1[]={0x02,0x20,0xE2,0x43,0x22,0x82,0x22,0x42,0x7F,0x3E,0x02,0x00,0x80,0x4F,0xBE,0x44};


uchr code tab0[]={0xF8,0x07,0xFC,0x0F,0x04,0x09,0xC4,0x08,0x24,0x08,0xFC,0x0F,0xF8,0x07,0x00,0x00}; // -0-

uchr code tab1[]={0x00,0x00,0x10,0x08,0x18,0x08,0xFC,0x0F,0xFC,0x0F,0x00,0x08,0x00,0x08,0x00,0x00};// -1-

uchr code tab2[]={0x08,0x0E,0x0C,0x0F,0x84,0x09,0xC4,0x08,0x64,0x08,0x3C,0x0C,0x18,0x0C,0x00,0x00}; // -2-

uchr code tab3[]={0x08,0x04,0x0C,0x0C,0x44,0x08,0x44,0x08,0x44,0x08,0xFC,0x0F,0xB8,0x07,0x00,0x00}; // -3-

uchr code tab4[]={0xC0,0x00,0xE0,0x00,0xB0,0x00,0x98,0x08,0xFC,0x0F,0xFC,0x0F,0x80,0x08,0x00,0x00}; // -4-

uchr code tab5[]={0x7C,0x04,0x7C,0x0C,0x44,0x08,0x44,0x08,0xC4,0x08,0xC4,0x0F,0x84,0x07,0x00,0x00}; // -5-

uchr code tab6[]={0xF0,0x07,0xF8,0x0F,0x4C,0x08,0x44,0x08,0x44,0x08,0xC0,0x0F,0x80,0x07,0x00,0x00}; // -6-

uchr code tab7[]={0x0C,0x00,0x0C,0x00,0x04,0x0F,0x84,0x0F,0xC4,0x00,0x7C,0x00,0x3C,0x00,0x00,0x00}; // -7-

uchr code tab8[]={0xB8,0x07,0xFC,0x0F,0x44,0x08,0x44,0x08,0x44,0x08,0xFC,0x0F,0xB8,0x07,0x00,0x00}; // -8-

uchr code tab9[]={0x38,0x00,0x7C,0x08,0x44,0x08,0x44,0x08,0x44,0x0C,0xFC,0x07,0xF8,0x03,0x00,0x00}; // -9-       

uchr code tab10[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00}; // .

uchr code tab11[]={0x30,0x0C,0x30,0x06,0x00,0x03,0x80,0x01,0xC0,0x00,0x60,0x0C,0x30,0x0C,0x00,0x00}; // -%-        .

uchr code tab12[]={0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x06,0x30,0x06,0x00,0x00,0x00,0x00,0x00,0x00}; // :       

uchr code tab13_0[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};  //空白

uchr code tab13_1[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

//温
uchr code  tab14_0[]={0x10,0x04,0x22,0x04,0x64,0xFE,0x0C,0x01,0x80,0x40,0x00,0x7E,0xFE,0x42,0x92,0x42};
uchr code  tab14_1[]={0x92,0x7E,0x92,0x42,0x92,0x7E,0x92,0x42,0xFF,0x42,0x02,0x7E,0x00,0x40,0x00,0x00};

//湿
uchr code  tab15_0[]={0x10,0x04,0x22,0x04,0x64,0xFE,0x0C,0x41,0x80,0x44,0xFE,0x48,0x92,0x50,0x92,0x7F};
uchr code  tab15_1[]={0x92,0x40,0x92,0x40,0x92,0x7F,0x92,0x50,0xFF,0x48,0x02,0x64,0x00,0x40,0x00,0x00};
          
//度          
uchr code  tab16_0[]={0x00,0x40,0x00,0x20,0xFC,0x9F,0x24,0x80,0x24,0x42,0x24,0x42,0xFC,0x26,0xA5,0x2A};
uchr code  tab16_1[]={0xA6,0x12,0xA4,0x2A,0xFC,0x26,0x24,0x42,0x34,0x40,0x26,0xC0,0x04,0x40,0x00,0x00};  

//现
uchr code  tab17_0[]={0x04,0x10,0x84,0x30,0x84,0x10,0xFC,0x1F,0x86,0x88,0x84,0x88,0x00,0x40,0xFE,0x23};
uchr code  tab17_1[]={0x02,0x18,0x82,0x07,0x7A,0x78,0x02,0x80,0xFF,0x83,0x02,0x80,0x00,0xE0,0x00,0x00};

//在
uchr code  tab18_0[]={0x08,0x08,0x08,0x04,0x08,0x02,0x08,0xFF,0xC8,0x00,0x38,0x40,0x0F,0x41,0x08,0x41};
uchr code  tab18_1[]={0x08,0x41,0xE8,0x7F,0x08,0x41,0x88,0x41,0x08,0x41,0x0C,0x60,0x08,0x40,0x00,0x00};

//时
uchr code  tab19_0[]={0x00,0x00,0xFC,0x3F,0x84,0x10,0x84,0x10,0x84,0x10,0xFE,0x3F,0x14,0x00,0x10,0x00};
uchr code  tab19_1[]={0x90,0x00,0x10,0x23,0x10,0x40,0x10,0x80,0xFF,0x7F,0x10,0x00,0x10,0x00,0x00,0x00};

//刻
uchr code  tab20_0[]={0x08,0x40,0x88,0x48,0x88,0x48,0xC8,0x28,0xA9,0x24,0x9E,0x12,0x88,0x19,0x88,0x24};
uchr code  tab20_1[]={0x6C,0x62,0x08,0x00,0xE0,0x0F,0x00,0x40,0x00,0x80,0xFF,0x7F,0x00,0x00,0x00,0x00};  
#endif



-------------------------------------主文件-----------------------------
#include"basic.h"
#include"154_Drive.h"
#include"595_Drive.h"
#include"Font.h"
uchr l;
uchr i;
uchr j;
loat tep=12.5;
float hum=88.5;

uchr temp[16]={0};
uchr  *tabnum[10]={tab0,tab1,tab2,tab3,tab4,tab5,tab6,tab7,tab8,tab9};
uchr  (*tempint_one)[16]=&tab0;

void main()
{
        //uchr i,j,k,l=0;
        uchr *ss[]={tab13_0,tab13_1,tab17_0,tab17_1,tab18_0,tab18_1,tab19_0,tab19_1,
        tab20_0,tab20_1,tab12,tab14_0,tab14_1,tab16_0,tab16_1,tab12,tab13_0,tab13_1,
        tempint_one};
        uchr a,b;
        HC154_Init();
        HC595_Init();

while(1)
        {       
                for(i=0;i<16;i++)
                {
                        a=*(ss[(l+i)/8]+(((l+i)%8) *2));
                        b=*(ss[(l+i)/8]+(((l+i)%8)*2)+1);
                        HC154_G=1;
                        HC154_Oput_IO(i);
                        HC595_Writedata(b,a);
                        HC154_G=0;
                }
                 
                j++;
                if(j==200)
                {
                        j=0;
                        l++;
                        l=(l>128)?0:l;
                }
        }
}

报错代码如下:
Rebuild target 'Target 1'
compiling 154_Drive.c...
compiling 595_Drive.c...
compiling main.c...
main.c(55): error C247: non-address/-constant initializer
Target not created.
Build Time Elapsed:  00:00:01



分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:157057 发表于 2017-7-8 17:35 | 只看该作者
程序不完整,这样贴出来大家帮不了你。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表