What does this mean? It gives an error.

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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

Re: What does this mean? It gives an error.
snipped-for-privacy@vigoris.net (Sean Whitesell) wrote in

Quoted text here. Click to load it

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.

Quoted text here. Click to load it

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

Quoted text here. Click to load it

Then this C code was not written for HiTech. See the HiTech manual as to
how you declare SFR's.
 
Quoted text here. Click to load it

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 ->
--

Re: What does this mean? It gives an error.

Quoted text here. Click to load it

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
Quoted text here. Click to load it



Site Timeline