
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
"Mark A. Odell" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] (Sean Whitesell) wrote in > news:[EMAIL PROTECTED]: > > > In some sample source code I have this line. > > > > static volatile unsigned char PCON @ 0x87; > > 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. > > > > > What exactly is the @ symbol for? > > It's an extension to the C language by the compiler vendor to make on-chip > Special Function Registers available to your C program. > > > I'm using the Hi-Tech compiler and its giving an error. It says > > "qualifiers redclared" and the caret is just under the @ symbol. > > Then this C code was not written for HiTech. See the HiTech manual as to > how you declare SFR's. 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 > > > 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. > > 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 -> > --
| <-- __Chronological__ --> | <-- __Thread__ --> |