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
  • Bit fields can be quite nice sometimes, but you do not want to use them when accessing real hardware, or when generating output files that must be read by different programs.

    Do not rely on the location of the individual bit fields in the struct! Different compilers may perform the bit allocation differently. Use the pointer and or/and bits instead.

Reply
  • Bit fields can be quite nice sometimes, but you do not want to use them when accessing real hardware, or when generating output files that must be read by different programs.

    Do not rely on the location of the individual bit fields in the struct! Different compilers may perform the bit allocation differently. Use the pointer and or/and bits instead.

Children