PicKit 3 & MPLab X

Discussion in 'Programmer's Corner' started by HarG, Nov 20, 2012.

  1. HarG

    Thread Starter New Member

    Nov 20, 2012
    18
    0
    Beginner with PICs and sorry in advance if I missed a thread that covered this.

    I bought a PICKit 3 Express and none of the software mentioned in the tutorial is easily available so I am using MPLab X with XC8 Compiler. I've set the PICKit 3 to provide the voltage as well.

    My source code (below) seems to build fine and it even says it is programming but nothing is happening on my board. Any help would be excellent.

    #include <xc.h>
    #include <stdio.h>
    #include <stdlib.h>
    #define _XTAL_FREQ 1000000

    /*
    *
    */
    void main(void)
    {
    PORTD = 0;
    TRISD = 0b00000000;
    LATDbits.LATD7 = 1;
    while (1);
    }
     
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Have you measured the voltage to ensure that the Pickit is, indeed, supplying power?

    Also, your compiler may be optimizing the while(1); out....
     
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    I can not see any setting of the configuration bits. That may be your problem. Aslo as mention. PICKIT 3 has by defualt power not supplied to the target chip. It must be turned on, in MPLAB
     
  4. HarG

    Thread Starter New Member

    Nov 20, 2012
    18
    0
    Thanks for the replies.

    pragma config FOSC=INTIO7 brought it to life. Silly mistake.
     
  5. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    It happens, I bricked a 10F320 by forgetting this line when I moved over to XC8...
     
Loading...