首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 嵌入开发 > 单片机 >

关于IAR使用结构变量的有关问题(msp430)

2013-09-07 
关于IAR使用结构变量的问题(msp430)本帖最后由 skevil 于 2013-08-25 19:23:52 编辑#define uchar unsigne

关于IAR使用结构变量的问题(msp430)
本帖最后由 skevil 于 2013-08-25 19:23:52 编辑


#define uchar unsigned char
 
struct FindGB16
{
  uchar Index[3];
  uchar data[32];
};

struct FindGB16  GB16[]=   //为结构变量初始化
{
  "我", 0x20,0x24,0x24,0x24,0xFE,0x23,0x22,0x20,
      0xFF,0x20,0x22,0xAC,0x20,0x30,0x20,0x00,
      0x00,0x08,0x48,0x84,0x7F,0x02,0x21,0x10,
      0x09,0x06,0x1A,0x61,0x80,0xE0,0x00,0x00,
  
  "有", 0x04,0x04,0x04,0x84,0xE4,0x3C,0x27,0x24,
      0x24,0x24,0x24,0xF4,0x24,0x06,0x04,0x00,
      0x04,0x02,0x01,0x00,0xFF,0x09,0x09,0x09,
      0x09,0x49,0x89,0x7F,0x00,0x00,0x00,0x00,

  "一", 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
      0x80,0x80,0x80,0x80,0x80,0xC0,0x80,0x00,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

  "个", 0x80,0x80,0x40,0x20,0x10,0x08,0x04,0xE3,
      0x04,0x08,0x10,0x20,0x40,0xC0,0x40,0x00,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};



请问我这样初始化有什么问题吗?
Error[Pe101]: "FindGB16" has already been declared in the current scope (at line 3) C:\Users\Administrator\Desktop\TFT2.4\chinese.h 3 

Error[Pe148]: variable "GB16" has already been initialized (at line 9) C:\Users\Administrator\Desktop\TFT2.4\chinese.h 9 
为啥报错呢?
[解决办法]
语法错误,初始化不是这样的,给你一个参考


typedef struct
{
  uchar Index[3];
  uchar data[32];
}FindGB16;
 
const FindGB16 GB16[4]=
{
  {
    {"我"},//这里其实有问题,"我"这个字符串应该不止三个字节
     {0x20,0x24,0x24,0x24,0xFE,0x23,0x22,0x20,


      0xFF,0x20,0x22,0xAC,0x20,0x30,0x20,0x00,
      0x00,0x08,0x48,0x84,0x7F,0x02,0x21,0x10,
      0x09,0x06,0x1A,0x61,0x80,0xE0,0x00,0x00,
     }
   },
   {
      {"有"},
      {
         0x04,0x04,0x04,0x84,0xE4,0x3C,0x27,0x24,
         0x24,0x24,0x24,0xF4,0x24,0x06,0x04,0x00,
         0x04,0x02,0x01,0x00,0xFF,0x09,0x09,0x09,
         0x09,0x49,0x89,0x7F,0x00,0x00,0x00,0x00,
      }
   },
   ........
};


你在网上找下结构体用法

热点排行