Fred.Amoson
New Member
I'm working with a PIC18LF4423 and I am getting some really weird behavior.
I am writing all of the code in MPLAB with C18. I am programming with a PICKIT2. After I make a new build of my program I will program the PIC from MPLAB. When I do this the code starts executing about 1/2 the time. The other 1/2 of the time it does not. If I unplug the power and power it back up without programming the chip again (even if the code hasn't changed) the code _never_ runs. I always have to program before it executes. I've been finding that on the times I program it and it doesn't execute, it sometimes starts to execute the program if I start checking pin voltages.
This makes me think that maybe something is wrong with my config bits? It seems like it doesn't want to run unless it experiences some noise, but I am pretty sure the clock is set up correctly to be internal and 8 MHz.
I've attached a pic of my config bits, and the first line in my void main() is:
OSCCON = 0b01110000; //8MHz Clock
Any help would be greatly appreciated!
I am writing all of the code in MPLAB with C18. I am programming with a PICKIT2. After I make a new build of my program I will program the PIC from MPLAB. When I do this the code starts executing about 1/2 the time. The other 1/2 of the time it does not. If I unplug the power and power it back up without programming the chip again (even if the code hasn't changed) the code _never_ runs. I always have to program before it executes. I've been finding that on the times I program it and it doesn't execute, it sometimes starts to execute the program if I start checking pin voltages.
This makes me think that maybe something is wrong with my config bits? It seems like it doesn't want to run unless it experiences some noise, but I am pretty sure the clock is set up correctly to be internal and 8 MHz.
I've attached a pic of my config bits, and the first line in my void main() is:
OSCCON = 0b01110000; //8MHz Clock
Any help would be greatly appreciated!