I am trying to debug code on PIC16F677 using MPLAB X IDE (v3.10) and Pickit 3 and result is this message – The target device is not ready for debugging. Please check your configuration bit settings and program the device before proceeding. The most common causes for this failure are oscillator and/or PGC/PGD settings.
Code looks like this.
#include <xc.h>
#include <stdbool.h>
#pragma config FOSC = INTRCIO
#pragma config WDTE = OFF // Watchdog Timer Enable bit
#pragma config PWRTE = OFF // Power-up Timer Enable bit
#pragma config MCLRE = OFF // MCLR Pin Function Select bit
#pragma config CP = OFF // Code Protection bit
#pragma config CPD = OFF // Data Code Protection bit
#pragma config BOREN = ON // Brown-out Reset Selection bits
#pragma config IESO = OFF // Internal External Switchover bit
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enabled bit
#define _XTAL_FREQ 8000000
void main(void)
{
IRCF0 = 7;
IRCF1 = 7;
IRCF2 = 7;
HTS = 1;
SCS = 1;
while (true)
{
}
}
I am not sure about those IRCF. Just tried out some things. I have tried without configuration bits in main function as well.
Do I need external oscillator for this? This poster http://ww1.microchip.com/downloads/en/DeviceDoc/50002010B.pdf says – Target device must be running
with an oscillator for the debugger
to function as a debugger. What does that even mean?
Best Answer
This micro doesn't contain debug executive inside, you can only program it via PGC/PGD, not debug. In order to debug you need a special part AKA debug header, see here for exact part number -> http://ww1.microchip.com/downloads/en/DeviceDoc/51292R.pdf