打印

请教 使用IAR环境 的大侠如何定义像 51下的 CODE

[复制链接]
3139|4
手机看帖
扫描二维码
随时随地手机跟帖
沙发
itelectron|  楼主 | 2009-6-30 21:10 | 只看该作者

如下

unsigned char code yi[]={"一"};
unsigned char code er[]={"二"};
unsigned char code san[]={"三"};
unsigned char code si[]={"四"};
unsigned char code wu[]={"五"};
unsigned char code liu[]={"六"};
unsigned char code ri[]={"日"};

IAR下如何定义  不占RAM空间

使用特权

评论回复
板凳
Again_gyf| | 2009-6-30 21:31 | 只看该作者

const

使用特权

评论回复
地板
itelectron|  楼主 | 2009-6-30 21:35 | 只看该作者

21ic 发布时间: 2007-05-22

用IAR 如何在程序空间定义数组? 
新闻出处:21ic 发布时间: 2007-05-22 
bai4004 发布于 2007-5-17 18:22:00 
我用IAR编译器
想在程序空间定义一个数组:如下,
flash unsigned char stone[];
但编译错误,我加了头文件pgmspace.h后还是编译不通过。
请教一下该怎么定义??




--------------------------------------------------------------------------------
bai4004 发布于 2007-5-17 18:48:00 
我现在就直接定义const unsigned char stone[];能编译通过,但不知道怎么把他读出来?再请教了!




--------------------------------------------------------------------------------
maomao40 发布于 2007-5-18 10:25:00 
用以下方式定义:
__flash unsigned char f_test[]={0,1,2,3,4,5};
通过以下方式读取
unsigned char g_test[];
unsigned char i;
for(i=0;i<6;i++)
    g_test=f_test;






--------------------------------------------------------------------------------
zhangfly 发布于 2007-5-18 14:59:00 
The extended keywords that can be used for data control the following:
● For data memory space, keywords that control the placement and type of objects
and pointers: __tiny, __near, __far, __huge, and __regvar
● For the EEPROM memory space, keyword that controls the placement and type of
objects and pointers: __eeprom
● For the code (flash) memory space, keywords that control the placement and type of
objects and pointers: __tinyflash, __flash, __farflash, and __hugeflash
● For the I/O memory space, keyword that controls the placement and type of objects
and pointers: __ext_io, __io
● Special pointer that can access data objects in both data and code memory space:
__generic
● Other characteristics of objects: __root and __no_init.




--------------------------------------------------------------------------------
bai4004 发布于 2007-5-22 16:16:00 
谢谢各位的回答:
我又试了一下,flash unsigned char stone[];
__flash unsigned char f_test[]={0,1,2,3,4,5};都可以了
在comp_a90.h 30 里面有如下定义  #define flash    const __flash
因此两种都是可以的。
但是,我还没找到那里定义的__flash,四楼说的原文在哪里?
 

使用特权

评论回复
5
itelectron|  楼主 | 2009-6-30 21:35 | 只看该作者

唉 我问的太晚 了 郁闷

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

274

主题

2762

帖子

8

粉丝