1
\$\begingroup\$

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:

schematic

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?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Not related to your question, but what are you expecting to happen when your main() ends ... ? \$\endgroup\$
    – brhans
    Mar 21, 2018 at 2:04
  • \$\begingroup\$ 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. \$\endgroup\$
    – malachik
    Mar 21, 2018 at 15:07

2 Answers 2

2
\$\begingroup\$

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).

\$\endgroup\$
3
  • \$\begingroup\$ 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. \$\endgroup\$
    – malachik
    Mar 21, 2018 at 15:05
  • \$\begingroup\$ Is the "power target circuit from PicKit3" checkbox in your MPLAB project properties checked? \$\endgroup\$ Mar 21, 2018 at 20:27
  • \$\begingroup\$ 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. \$\endgroup\$
    – malachik
    Mar 21, 2018 at 20:50
1
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.