I can program for release but not for debug!
I have connected up a PIC16F722 to an RJ11 header for use with my ICD3. I have supplied power via a 240V to 35V step down transformer, rectified, smoothed with large capacitor and regulated with a LM7805. The output voltage is 5.15V according to the oscilloscope.
I can program the device when I am just programing and not debugging the program works, changing the clock speed and toggling PORTB indefinitely. However when trying to debug the program does not run at all. I often but not always receive the error:
The following memory regions failed to program correctly:
Debug Executive
Programming failed
I am not sure what is going wrong. The problem seems to be worse when I use my own power supply and not the ICD3 on board power supply. So far I am investigating three potential sources of the problem, I am not sure at all if these are the sources I am just guessing at this stage.
1. Capacitance added to the power terminals of my PIC16F722 the ICD3 quick start has a picture showing that no capacitance should be added to the power terminals of the micro, I thought this was a mistake on their part.
2. I have missed a configuration bit required for debugging.
3. Cross talk and or noise on my in circuit serial programing lines.
Any other advice on whether capacitance should be removed from the micro power terminals, or other potential problems I have missed, would be much appreciated.
Here is the simple program I am using to get started.
#include <htc.h>
__CONFIG(INTCLKO & WDTDIS & PWRTDIS & BORDIS &
DEBUGEN & UNPROTECT);
void main(void)
{
// port directions: 1=input, 0=output
TRISB = 0b00000000;
OSCCON = 0xff;
while (1){
PORTB = 0xff;
_delay(1000);
PORTB = 0x00;
_delay(1000);
}
}
The PIC is being used for a switch mode current controlled variable voltage supply, hence the large diode bridge seen on the board. The two other chips are latching BCD to HEX converters and the small MOSFETS are 2N7000's. None of these other components are connected.