使用的是CH559L芯片,用的是官方提供的CH559.h文件
報(bào)錯(cuò)信息如下:
遇到的情況如下:
1、經(jīng)過(guò)測(cè)試,如果有兩個(gè).c文件包含了CH559.h頭文件就會(huì)出現(xiàn)如上信息
2、報(bào)錯(cuò)的對(duì)象都來(lái)自于CH559.h
3、為了進(jìn)行模塊化編寫(xiě),又不能在一個(gè)C文件里寫(xiě)所有代碼,所以請(qǐng)教一下這個(gè)問(wèn)題要怎么解決啊
使用的是CH559L芯片,用的是官方提供的CH559.h文件
報(bào)錯(cuò)信息如下:
遇到的情況如下:
1、經(jīng)過(guò)測(cè)試,如果有兩個(gè).c文件包含了CH559.h頭文件就會(huì)出現(xiàn)如上信息
2、報(bào)錯(cuò)的對(duì)象都來(lái)自于CH559.h
3、為了進(jìn)行模塊化編寫(xiě),又不能在一個(gè)C文件里寫(xiě)所有代碼,所以請(qǐng)教一下這個(gè)問(wèn)題要怎么解決啊
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可以發(fā)我一份嗎?
你好,可以在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.