PIC24 PicKit3无法调试

时间:2014-07-10 20:47:52

标签: debugging microchip

我试图在PIC24F04KA200上调试我的代码。但是当我开始调试时,我收到消息: 目标设备尚未准备好进行调试。在继续之前,请检查配置位设置并对设备进行编程。导致此故障的最常见原因是振荡器和/或PGC / PGD设置。

我引用了PicKit3用户指南,但我找不到答案。 PicKit连接到PGC2和PGD2引脚。我的配置位:

/* 
 * File:   config.h
 *
 */

#ifndef CONFIG_H
#define CONFIG_H

#ifdef  __cplusplus
extern "C" {
#endif

#ifdef  __cplusplus
}
#endif

#endif  /* CONFIG_H */


#include <p24F04KA200.h>


// PIC24F04KA200 Configuration Bit Settings

// 'C' source line config statements

#include <xc.h>

// FBS

// FGS
#pragma config GWRP = OFF               // General Segment Code Flash Write Protection bit (General segment may be written)
#pragma config GCP = OFF                // General Segment Code Flash Code Protection bit (No protection)

// FOSCSEL
#pragma config FNOSC = FRCDIV           // Oscillator Select (8 MHz FRC oscillator with divide-by-N (FRCDIV))
#pragma config IESO = OFF               // Internal External Switch Over bit (Internal External Switchover mode disabled (Two-Speed Start-up disabled))

// FOSC
#pragma config POSCMOD = NONE           // Primary Oscillator Configuration bits (Primary oscillator disabled)
#pragma config OSCIOFNC = ON            // CLKO Enable Configuration bit (CLKO output disabled)
#pragma config POSCFREQ = MS            // Primary Oscillator Frequency Range Configuration bits (Primary oscillator/external clock input frequency between 100 kHz and 8 MHz)
#pragma config SOSCSEL = SOSCHP         // SOSC Power Selection Configuration bits (Secondary oscillator configured for high-power operation)
#pragma config FCKSM = CSECMD           // Clock Switching and Monitor Selection (Clock switching is enabled, Fail-Safe Clock Monitor is disabled)

// FWDT
#pragma config WDTPS = PS32768          // Watchdog Timer Postscale Select bits (1:32,768)
#pragma config FWPSA = PR128            // WDT Prescaler (WDT prescaler ratio of 1:128)
#pragma config WINDIS = OFF             // Windowed Watchdog Timer Disable bit (Standard WDT selected; windowed WDT disabled)
#pragma config FWDTEN = OFF             // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))

// FPOR
#pragma config BOREN = BOR0             // Brown-out Reset Enable bits (Brown-out Reset disabled in hardware; SBOREN bit disabled)
#pragma config PWRTEN = OFF             // Power-up Timer Enable bit (PWRT disabled)
#pragma config BORV = LPBOR             // Brown-out Reset Voltage bits (Low-Power Brown-out reset occurs around 2.0V)
#pragma config MCLRE = ON               // MCLR Pin Enable bit (MCLR pin enabled; RA5 input pin disabled)

// FICD
#pragma config ICS = PGx2               // Reserved (PGC2/PGD2 are used for programming the device)

// FDS
#pragma config DSWDTPS = DSWDTPSF       // Deep Sleep Watchdog Timer Postscale Select bits (1:2,147,483,648 (25.7 Days))
#pragma config DSLPBOR = OFF            // Deep Sleep Zero-Power BOR Enable bit (Deep Sleep BOR disabled in Deep Sleep)
#pragma config DSWDTEN = OFF            // Deep Sleep Watchdog Timer Enable bit (DSWDT disabled)

我的主要档案:

/* 
 * File:   main.c
 */
#include "config.h"
#include <stdio.h>
#include <stdlib.h>


int main(int argc, char** argv)
{
    while(1)
    {
        ;
    }
}

处理器正在运行。我有一个运行的blinkerLed程序。 有没有人有建议?

1 个答案:

答案 0 :(得分:0)

该微控制器没有嵌入式调试功能。如果你想为这个UC调试你的应用程序,你将不得不使用一个模拟器或模拟器(不是我最喜欢的,但它有时可以让你脱离绑定)。

来自Microchip网站:

  

采用nanoWatt XLP技术,非常适合电池应用   (请使用PIC24F16KA102处理器扩展包进行仿真和   调试支持-AC244028。 该MCU没有片上调试功能   能力)