我使用JL8,想在Z_RAM中定义若干个变量,可以进行微操作。仿照自带的定义方式,在主程序中给变量赋值,make以后就提示fixup overflow in main,to _nflag0 type 1,at offset 0x6 。请达人帮忙看下是哪里出了问题,或者有什么更好的解决方法。
程序如下:
/*** nflag0 - 0x0060 ***/
typedef union {
byte Byte;
struct {
byte standbyf :1;
byte alterf0 :1;
byte fasttestf :1;
byte nflag03 :1;
byte nflag04 :1;
byte nflag05 :1;
byte economicf :1;
byte disp2sf :1;
} Bits;
struct {
byte grpnflag0 :8;
} MergedBits;
} nflag0STR;
extern volatile nflag0STR _nflag0 @0x0060;
#define nflag0 _nflag0.Byte
#define standbyf _nflag0.Bits.standbyf
#define alterf0 _nflag0.Bits.alterf0
#define fasttestf _nflag0.Bits.fasttestf
#define nflag03 _nflag0.Bits.nflag03
#define nflag04 _nflag0.Bits.nflag04
#define nflag05 _nflag0.Bits.nflag05
#define economicf _nflag0.Bits.economicf
#define disp2sf _nflag0.Bits.disp2sf
#define nflag0_nflag0 _nflag0.MergedBits.grpnflag0
main中:
nflag0 = 1;
将这句extern volatile nflag0STR _nflag0 0x0060;
换成定义一个变量,不管它的地址
即
#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGE
nflag0STR _nflag0;
#define nflag0 _nflag0.Byte
#define standbyf _nflag0.Bits.standbyf
#define alterf0 _nflag0.Bits.alterf0
#define fasttestf _nflag0.Bits.fasttestf
#define nflag03 _nflag0.Bits.nflag03
#define nflag04 _nflag0.Bits.nflag04
#define nflag05 _nflag0.Bits.nflag05
#define economicf _nflag0.Bits.economicf
#define disp2sf _nflag0.Bits.disp2sf
#define nflag0_nflag0 _nflag0.MergedBits.grpnflag0
[此贴子已经被作者于2005-12-20 21:27:27编辑过]
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |