Pickit 2调试器

Pickit 2 debugger

我是 PIC 的新手。我正在使用带有 Pickit 2 和 XC8 编译器的 MPLAB IDE ver 8.92。我试图对 PIC12F508 芯片进行编程以制作 LED 闪光灯。该程序已构建并编程到芯片中。但是LED不闪,于是想到调试程序。我 select 程序员 none,select 调试器 select Pickit 2。在那之后,我点击连接,然后点击程序。一个错误提示我PK2Error0027: Failed verify (Address = 0x4 - Expected Value 0x64 - Value Read 0x60)。如果我在调试器菜单下单击 运行,它会显示 PK2Error0028: unable to enter debug mode。我错过了什么或做错了什么吗?

更新程序:

#define _XTAL_FREQ 4000000
#include <xc.h>

//__CONFIG(MCLRE_ON & CP_OFF & WDT_OFF & OSC_IntRC);

#pragma config OSC = IntRC      // Oscillator Selection bits (internal RC oscillator)
#pragma config WDT = OFF        // Watchdog Timer Enable bit (WDT disabled)
#pragma config CP = OFF         // Code Protection bit (Code protection off)
#pragma config MCLRE = ON      // GP3/MCLR Pin Function Select bit (GP3/MCLR pin function is digital input, MCLR internally tied to VDD)

void main()
{
    TRIS = 0b011111;

    GPIObits.GP5 = 1;
    __delay_ms(1000);
    GPIObits.GP5 = 0;
    __delay_ms(1000);

}

包括:

我的电路

您需要第二次延迟:

include <xc.h>
#define _XTAL_FREQ 4000000

void main()
{
    TRIS = 0b000000;

    for (;;)
    {
        GPIO = 0b00111111;    //work with 8 Bits here
        __delay_ms(1000);
        GPIO = 0b00000000;
       __delay_ms(1000);     //delay loop for OFF time
    }    
}

那是你的 LED 灯有问题。对于 PICKit 错误,请查看配置设置。试试 __CONFIG _DEBUG_OFF.

调试的问题是12F508没有调试功能。您只能对该设备进行编程。许多较旧的 PIC 微控制器(尤其是 8 引脚器件)没有调试芯片。有时会有一个特殊的调试头,它有一个具有调试功能的硅调试变体和用于访问调试器的附加引脚。

有关此主题的更多信息,请查看此 post:https://www.microforum.cc/topic/16-debugging-low-pincount-picmicrocontrollers