2010/03/16〜2010/03/24 | |
K.I | |
PICKIT3ピン番号 PICKIT3端子名 12F683ピン番号 12F683端子名 1 ▼Vpp/MCLR 4 MLCR 2 Vdd 1 Vdd 3 Gnd 8 Gnd 4 ICSPDAT/PGD 7 ICSPDAT 5 ICSPCLK/PGC 6 ICSPCLK 6 LVP
#include <htc.h> #ifndef _XTAL_FREQ #define _XTAL_FREQ 4000000 #endif void main(void){ TRISIO = 0xFA; OSCCON = 0x61; //4MHz Internal OSC while(1){ __delay_ms(125);__delay_ms(125);__delay_ms(125);__delay_ms(125); //500ms delay GPIO = 0x04; __delay_ms(125);__delay_ms(125);__delay_ms(125);__delay_ms(125); //500ms delay GPIO = 0x00; } }
PK3Err0045: You must connect to a target device to use PICkit
A debug header is required in order to debug this part. Please make sure you are using the header part before continuing. Press OK to continue or Cancel to quit.
#include <htc.h> #ifndef _XTAL_FREQ #define _XTAL_FREQ 4000000 #endif void main(void){ int i; OPTION = 0xC7; TRISGPIO = 0xFA; GPIO = 0x00; CLRWDT(); while(1){ for (i=0; i<50 ;i++) { __delay_ms(10); CLRWDT(); } //500ms delay GPIO = 0x04; for (i=0; i<50 ;i++) { __delay_ms(10); CLRWDT(); } //500ms delay GPIO = 0x00; } }
/* MCLR Pin function */ #define MCLREN 0xFFF // master clear reset enable #define MCLRDIS 0xFEF // master clear reset disable /* watchdog*/ #define WDTEN 0xFFF // watchdog timer enable #define WDTDIS 0xFFB // watchdog timer disable /* code protection */ #define PROTECT 0xFF7 // protect the program code #define UNPROTECT 0xFFF // do not protect the program code
#include <htc.h> #ifndef _XTAL_FREQ #define _XTAL_FREQ 4000000 #endif __CONFIG(MCLRDIS & WDTDIS & UNPROTECT); void main(void){ OPTION = 0xC7; TRISGPIO = 0xFA; while(1){ __delay_ms(125);__delay_ms(125);__delay_ms(125);__delay_ms(125); //500ms delay GPIO = 0x04; __delay_ms(125);__delay_ms(125);__delay_ms(125);__delay_ms(125); //500ms delay GPIO = 0x00; } }
__CONFIG(RCIO & MCLREN & WDTDIS & UNPROTECT & DEBUGEN);
PK3Err0033: 4 bytes expected, 2 bytes received Stepping target failed
#include <htc.h> #ifndef _XTAL_FREQ #define _XTAL_FREQ 4000000 #endif __CONFIG(RCIO & MCLREN & WDTDIS & UNPROTECT & DEBUGEN); void main(void){ OPTION = 0x00; TRISA = 0xFA; OSCCON = 0x60; // Internal RC Osc 4MHz ANSEL = 0x00; // All Degital I/O Select CMCON = 0x07; // Comparator OFF CVRCON = 0x00; // CVR OFF ADCON0 = 0x00; // ADC OFF while(1){ // __delay_ms(125);__delay_ms(125);__delay_ms(125);__delay_ms(125); //500ms delay PORTA = 0x04; // __delay_ms(125);__delay_ms(125);__delay_ms(125);__delay_ms(125); //500ms delay PORTA = 0x00; } }
The following memory regions failed to program correctly
PICkit 3 Connected. The overcurrent logic has detected a fault condition on either VPP or VDD. Please disconnect your circuit check MCLR or VDD for a short circuit and then reconnect. Also, ensure that your target current requirements do not exceed the specified limits.
TRISIO = 0xCC; // GP0,1,4,5を出力設定 CMCON0 = 0x07; // コンパレータをOFFに ANSEL = 0x00; // 全端子をデジタルI/Oに設定
__CONFIG(RCIO & MCLRDIS & WDTDIS & UNPROTECT);