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

Struct for registers

Hello,

i'm using keil 3.05 evaluation, its my first experience with this tool.
Normally i found in other tools a struct inside the .h of the uproc. In this case i found just a define.

#define PCON (*((volatile unsigned char *) 0xE01FC0C0))

trying to create a structure, i dont know how to set the struct mem position. I've tried this code bellow without sucess.

/* Cria os bits da estrutura */
struct { unsigned int PLLE : 1; unsigned int PLLC : 1; unsigned int NotUsed : 6;
} PCONbits __at 0xE01FC0C0;

i'll have this libs with the full version of keil tools?

thanks!
Jose

Parents Reply Children
  • If you write a PC program that generates an output file, then it is important that the output file has a file format that you may always be able to read again.

    If the file is binary, and you make use of bit fields, then a compiler change may make the recompiled code unable to read back the data.

    Hence my note about output files. But the problem is similar for embedded systems if you store configuration in EEPROM or FLASH memory and support firmware updates.

    If you change (or upgrade) the compiler and then rebuild the application, then you can not be sure that the recompiled application will read back the same bit-field contents from EEPROM or FLASH.

  • This solution with macros can help me,

    thanks!