This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Intrinsic function and xc16x.h header

Hello:

I'm developing a software for Infineon XC167CI, and I'm using DAvE and Keil uVision2 for it. I cannot get through a problem concerning the intrinsic function _bfld_, whose prototype is:
void _bfld_ (unsigned int sfr_, unsigned mask1, unsigned mask2)

Using a statement such as:

_bfld_ (PSW, 0xF000, 0xF000); // disable interrupts
returns the error:
MAIN.C(453): error C167: intrinsic '_bfld_': declaration/activation error

The problem is (IMHO): the argument "sfr_" has "unsigned int" type, but must be declared as an SFR type, e.g.:
sfr PSW = 0xFF10; (as it is in xc16x.h header), but DAvE declares PSW as a macro:
#define PSW (*((uword volatile *) 0xFF10)), as it is in my main.h header.

Using just one of the headers (<xc16x.h> instead of <main.h> or vice versa) won't work in my application. The compiling fails.
Also, using both of them will obviously fail, because of the redefinitions.
The ApNote #138 software (http://www.keil.com/download/files/apnt_138.zip) shows _bfld_ works with xc16x.h, but I need also main.h in my project.
I would appreciate sugestions, further information or workarounds...

Lucas

0