On 28 December 2011 16:38, wrote: >> I can?t seem to figure out how to write to OSCCON as if it were a >> simple register. I?ve included the p24Hxxxx.h header file, but can?t >> seem to do simple things like ?OSCCON.OSWEN =3D true;?. Am I missing >> something? > > IIRC there is an unlock sequence for OSCCON that you have to perform befo= re modifying the register. C30 has a macro to handle this easily. __builtin_write_OSCCONL Description: Unlocks and writes its argument to OSCCONL. Prototype: void __builtin_write_OSCCONL(unsigned char value); Argument: value character to be written Return Value: None. Assembler Operator / Machine Instruction*: mov #0x46, w0 mov #0x57, w1 mov __OSCCON, w2 mov.b w0, [w2] mov.b w1, [w2] mov.b value, [w2] Error Messages None. * The exact sequence may be different. __builtin_write_OSCCONH Description: Unlocks and writes its argument to OSCCONH. Prototype: void __builtin_write_OSCCONH(unsigned char value); Argument: value character to be written Return Value: None. Assembler Operator / Machine Instruction*: mov #0x78, w0 mov #0x9A, w1 mov __OSCCON+1, w2 mov.b w0, [w2] mov.b w1, [w2] mov.b value, [w2] Error Messages None. * The exact sequence may be different. --=20 Martin K. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .