What does this mean? It gives an error.

In some sample source code I have this line.

static volatile unsigned char PCON @ 0x87;

What exactly is the @ symbol for?

I'm using the Hi-Tech compiler and its giving an error. It says "qualifiers redclared" and the caret is just under the @ symbol.

FYI, this is for an 8051 Atmel chip. The samlple source came from Atmel. Also, I'm missing a intrins.h file that is called in other source files but was not included on the CD.

Thanks, Sean

Reply to
Sean Whitesell
Loading thread data ...

snipped-for-privacy@vigoris.net (Sean Whitesell) wrote in news: snipped-for-privacy@posting.google.com:

This is not C but an extension to C for use with the 8051 microcontroller. It declares the PCON register at DATA address 0x87 for use by your C program. If you don't know what PCON is read the Intel MCS-51 User's Manual.

It's an extension to the C language by the compiler vendor to make on-chip Special Function Registers available to your C program.

Then this C code was not written for HiTech. See the HiTech manual as to how you declare SFR's.

It is trivial to convert to HiTech I'm sure. Just look in one of HiTech's .h files to see how they declare SFR's.

- Mark ->
Reply to
Mark A. Odell

The @ symbol certainly WAS a HI-TECH C contruct not so long ago and I would be surprised if they had changed this. The advantage of this construct is that the symbol so defined is listed in the symbol file produced by the linker. This does not happen with the standard method of defining a handle to reference the contents of a specified (SFR) memory location:

#define PCON (*((unsigned char *) 0x87))

in which the symbol PCON is lost as soon as the C preprocessor has done it's work.

Dave Bardon, Avocet

Reply to
David Bardon

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.