使用的是CH559L芯片,用的是官方提供的CH559.h文件
报错信息如下:
遇到的情况如下:
1、经过测试,如果有两个.c文件包含了CH559.h头文件就会出现如上信息
2、报错的对象都来自于CH559.h
3、为了进行模块化编写,又不能在一个C文件里写所有代码,所以请教一下这个问题要怎么解决啊
使用的是CH559L芯片,用的是官方提供的CH559.h文件
报错信息如下:
遇到的情况如下:
1、经过测试,如果有两个.c文件包含了CH559.h头文件就会出现如上信息
2、报错的对象都来自于CH559.h
3、为了进行模块化编写,又不能在一个C文件里写所有代码,所以请教一下这个问题要怎么解决啊
The problem is that Keil c51 does Not Support a xsfr keyword. So you have to Work arround this.
The easy ugly way:
#define NO_XSFR_DEFINE
#include "ch559.h"
In all your c Files exept the first one to transate the xsfr defs to external declarations.
A better way would be to change ch559.h at the beginning with something Like this:
#ifdef __CH559_H__ //allready included somewhere
#define NO_XSFR_DEFINE
#endif
This way the header file itself will handle the changes.
I dont like the style of the original header files and therefore use my own ones.
@usbman还是不怎么懂,你用CH559.H可以发我一份吗?
你好,可以在CH559.h中增加NO_XSFR_DEFINE的宏定义。
Actually i forget to mention a third way.
You may set NO_XSFR_DEFINE in the Keil IDE under
options>Target>c51>defines globally vor all c files.
Then change your main.c (and only that one)
....
#undef NO_XSFR_DEFINE
#include "ch559.h"
....
By the way publishing my header files maybe does not make sense because i have designed them to be compatible with Keil, SDCC and IAR. Nothing vor a beginner i guess.