# Error Connecting PIC12F683 to MPLABX with PicKit3

Disclaimer: I am a complete noob when it comes to programming chips with a dedicated external programmer such as the PicKit3, as well as writing code for chips (especially not in C) so bear with me :)

I am attempting to connect a Microchip PIC12F683 8-bit microcontroller to my PC with a PicKit3 and MPLAB X. My main goal is just to be able to do a basic "Hello, World" by flashing an LED on one of the outputs. I have MPLAB X opened up with a new program in C with the following code:

/*
* File:   newmain.c
* Author: Malachi
*
* Created on March 20, 2018, 7:04 PM
*/

#include <stdio.h>
#include <xc.h>
#include <stdlib.h>

/*
*
*/
int main(int argc, char** argv) {
TRISIO = 0; // set as output
while(1) { // infinite loop

GPIO = (1<<4);
}
return (EXIT_SUCCESS);
}


When I hit "Run Main Project," it successfully builds (using the XC8 compiler I was instructed to install by MPLAB), but when it connects to the PicKit3, it says the following in the console:

Connecting to MPLAB PICkit 3...

Currently loaded firmware on PICkit 3
Firmware Suite Version.....01.51.08
Firmware type..............Midrange

Target device was not found (could not detect target voltage VDD). You must connect to a target device to use PICkit 3.


The PIC12F683 is wired to the PicKit3 like this:

simulate this circuit – Schematic created using CircuitLab

I'm not sure what this error means, or how to fix it. Does anyone have any advice as to what my next steps should be?

• Not related to your question, but what are you expecting to happen when your main() ends ... ? – brhans Mar 21 '18 at 2:04
• I had a friend who is more familiar with object-oriented programming (but not C specifically) help me develop the code, and my goal for this program was mainly to see if I could get anything at all loaded onto the PIC successfully, and then try for turning on pins, so to be honest, I have next to no idea what this code is supposed to do. – malachik Mar 21 '18 at 15:07

Is your device getting dc power? (That's what target voltage VDD means).

In your MPLAB project properties, there's a setting which determines whether the PicKit should supply the power (as indicated by your schematic), or not (i.e the power comes from your board's own power connection). It might be set wrong.

If your board has a lot of other parts on it besides the microcontroller, it's possible that it needs more current than the PicKit can supply, so you might need to use a separate power supply (and set the project setting accordingly).

• I have the PIC12 isolated on a breadboard with those connections only, but I am planning to attach an LED to one of the pins and drive it using the PicKit's Vdd, the limit for which is 30mA according to the datasheet. – malachik Mar 21 '18 at 15:05
• Is the "power target circuit from PicKit3" checkbox in your MPLAB project properties checked? – Jeanne Pindar Mar 21 '18 at 20:27
• I just went into MPLAB and looked through the programmer settings in the project properties, and it should now be powering the PIC with 5v. – malachik Mar 21 '18 at 20:50

In your MPLABX, you need to right click on your project->Properties->Select PICkit3 under Conf->From the dropdown "Option categories ", select Power, and check "Power target circuit from PICkit3"

It is very likely your target circuit is not getting sufficient voltage to work correctly.