pic32mplab-x

Program compiles but doesn't do anything


I've recently started exploring and reading about Microchip's PIC32 MCUs, most specifically for motor control. I had some job done over the years but was a long while and haven't used the IDE with evaluation board since university years. Been using Arduino-compatible boards since or boards, compatible with the Arduino IDE.

So I'm running MPLAB X IDE v6.05 with the latest XC32 Compiler. My Development board is DT100113 Curiosity Pro board, utilizing PIC32MK0512MCJ064 MCU and an on-board PicKit4 (PKoB4) for programming/debugging/serial connection purposes.

What I try to do is light up the two user LEDs on pins RA10 and RE13 respectively.

As I begin with creating new project, select my device, my program/debug tool and give my project a name, next step is to create a new main.c file.

I create the file and write the following:

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

#include <xc.h>


int main(int argc, char** argv) {

    //Define corresponding port bits as outputs (0 = output, 1 = input).
    TRISAbits.TRISA10 = 0;
    TRISEbits.TRISE13 = 0;
    
    //Latch the outputs to HIGH (1) and hold.
    while(1)
    {
        LATAbits.LATA10 = 1;
        LATEbits.LATE13 = 1;
    }
    return (EXIT_SUCCESS);
}

When I build and run it - nothing happens. Build is successful, connected to programmer, erase/flash device OK, but nothing with the LEDs.

I think I'm missing the #pragma directives (read about that it must be defined first prior anything else), but am unaware on how to set configuration bits (used peripherals, internal clock speed, etc.).

Any pointers to how-to articles, posts, etc. will be highly appreciated. I was not able to find step-by-step tutorial for my development board so far :((

Thank you in advance!

Cheers, Iliyan

I tried creating a new project, it compiled and ran, but the LEDs were not lit. Obviously was missing some vital parts in the code.


Solution

  • Application software examples and driver libraries are included as part of the MPLAB Harmony V3 Framework. Add Harmony to 'Embedded' under the 'Tools' tab of the MPLAB IDE.