iar头文件问题求教
union { \unsigned char _NAME; /* The sfrb as 1 byte */ \
struct { /* The sfrb as 8 bits */ \
__BYTEBITS(_NAME, _A,_B,_C,_D,_E,_F,_G,_H) \
};\
} @ _ADDR;
这里@是iar增加的新特性吗?ansi c没有这个操作符呀求解惑.. 是IAR的特性,但不是新特性{:lol:}
是指定变量的存储地址用的。 lcofjp 发表于 2013-4-9 12:04 static/image/common/back.gif
是IAR的特性,但不是新特性
是指定变量的存储地址用的。
受教了 但是我自这样写了一个定义
union {
unsigned char myregister; /* The sfrb as 1 byte */ \
int i ;
} @ 0x3F;
编译器报错
Error: location address not allowed for initialized variables (writable variables without the __no_init attribute)
卖菜老汉 发表于 2013-4-9 12:19 static/image/common/back.gif
受教了 但是我自这样写了一个定义
union {
unsigned char myregister; /* The sfrb a ...
指定地址只能用于两种情况,一个是常量(const修饰,一般放在flash中),另一个就是__no_init修饰的。也就是说这种变量不能被C运行时环境初始化。 空间地址不允许初始化变量?要加关键字__no_init来修饰?
iomacro.h 有类似格式。
这样可以通过编译:
__no_init union {
unsigned char myregister;
int i ;
} @0x3F; lcofjp 发表于 2013-4-9 13:03 static/image/common/back.gif
指定地址只能用于两种情况,一个是常量(const修饰,一般放在flash中),另一个就是__no_init修饰的。也 ...
感谢 明白了 hugolulu 发表于 2013-4-9 13:26 static/image/common/back.gif
空间地址不允许初始化变量?要加关键字__no_init来修饰?
iomacro.h 有类似格式。
这样可以通过编译:
OK 明白了
页:
[1]