>
> ? extern volatile unsigned int OSCCON __attribute__((__sfr__));
>
> __extension__ typedef struct tagOSCCONBITS { union { struct { unsigned
> OSWEN:1; unsigned LPOSCEN:1; unsigned :1; unsigned CF:1; unsigned :1;
> unsigned LOCK:1; unsigned IOLOCK:1; unsigned CLKLOCK:1; unsigned
> NOSC:3; unsigned :1; unsigned COSC:3; }; struct { unsigned :8; unsigned
> NOSC0:1; unsigned NOSC1:1; unsigned NOSC2:1; unsigned :1; unsigned
> COSC0:1; unsigned COSC1:1; unsigned COSC2:1; }; }; } OSCCONBITS; ?
>
>
>
>
> Ryan Pettigrew
>
> On 12/28/11,
piclist-request
spam_OUTmit.edu wrote:
>
>> but can?t seem to do simple things like ?OSCCON.OSWEN = true;?
>
> It is always a good idea to look at the appropriate header file.
>
> In most cases, what you want is something like
>
> OSCCONbits.OSWEN = 1;
>
> The symbol OSCCON itself refers to the entire register. If it were a
> struct you wouldn' tbe able to say things like
>
> OSCCON = 0x1234;
>
> so the struct has a different name. Almost always the register name
> followed by "bits".
>
> But once in a while there are surprises, so don't be shy about studying