Thanks to all who responded, this was exactly the problem. Once I realized how I had goofed reading the config section of the datasheet, I reworked what I had and came up with something similar to Mike's below and got the part running. Anthony >> > The brownout and power on timer are located in config register 2; by >> > adding them to config register 1 you have corrupted the oscillator >> > setting. >> > >> > Unless HiTech changed the way they defined stuff in the later > version I >> > think the rest of your config settings are wrong as well! Have a > look >> > in the device datasheet under "Special Features of the CPU" to find > out >> > which bits are located in which register. The 18F2321 has 7 config >> > registers to set. >> > >> > Regards >> > >> > Mike > >> -----Original Message----- >> From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On > Behalf >> Of toftat@cowshed.us >> Sent: 26 July 2011 18:02 >> To: Microcontroller discussion list - Public. >> Subject: RE: [PIC] MPLAB X, Hitech-C and configuration bits >> >> I found this very confusing when I was trying to figure it out, the >> constants from htc are defined as 16 bit values, yet the device > datasheet >> specifies things as 8 bit wide registers, and the first register they >> specify in the table is 0x300001 CONFIG1H. There is also missing > CONFIG3L. >> >> I will ignore the missing registers, and get things lined up properly >> later and see if that helps, thanks > > The defined constants are 16 bits, but the extra bits are ignored if the > config register is only 8 bits wide. Ignore the separate High and Low > registers for e.g. Config register 2, 5, 6 and 7 they are combined into > a single 16 bit value in the HiTech compiler. > > e.g. something like this: > > __CONFIG(1, INTCLKO & FCMDIS & IESODIS); > __CONFIG(2, BORDIS & BORV46 & PWRTDIS & WDTDIS & WDTPS32K) > __CONFIG(3, PBADDIS & LPT1DIS & MCLREN); > __CONFIG(4, DEBUGDIS & XINSTEN & STVREN & LVPDIS); > __CONFIG(5, UNPROTECT); > __CONFIG(6, WRTEN); > __CONFIG(7, TRU); > > Cheers > > Mike > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > This e-mail is intended for the person it is addressed to only. The > information contained in it may be confidential and/or protected by > law. If you are not the intended recipient of this message, you must > not make any use of this information, or copy or show it to any > person. Please contact us immediately to tell us that you have > received this e-mail, and return the original to us. Any use, > forwarding, printing or copying of this message is strictly prohibited. > No part of this message can be considered a request for goods or > services. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .