程序编译但没有执行任何操作。

huangapple go评论98阅读模式
英文:

Program compiles but doesn't do anything

问题

我最近开始探索和阅读关于Microchip的PIC32 MCU,尤其是用于电机控制的部分。多年来,我做了一些工作,但已经很久没有使用评估板的IDE,自从大学时代以来,一直在使用兼容Arduino的板或与Arduino IDE兼容的板。

所以我正在使用MPLAB X IDE v6.05与最新的XC32编译器。
我的开发板是DT100113 Curiosity Pro板,使用PIC32MK0512MCJ064 MCU和内置的PicKit4 (PKoB4)用于编程/调试/串行连接等目的。

我尝试要做的是点亮分别位于RA10和RE13引脚上的两个用户LED。

当我开始创建新项目时,选择我的设备、我的程序/调试工具并为项目命名,下一步是创建一个新的main.c文件。

我创建文件并编写以下内容:

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

int main(int argc, char** argv) {
    //将相应的端口位定义为输出 (0 = 输出, 1 = 输入)。
    TRISAbits.TRISA10 = 0;
    TRISEbits.TRISE13 = 0;
    
    //将输出锁存到高电平 (1) 并保持。
    while(1)
    {
        LATAbits.LATA10 = 1;
        LATEbits.LATE13 = 1;
    }
    return (EXIT_SUCCESS);
}

当我构建并运行它时,什么也不会发生。构建成功,连接到编程器,擦除/刷写设备也OK,但LED没有亮起。

我认为我错过了#pragma指令(读到必须在任何其他内容之前首先定义它),但不知道如何设置配置位(使用的外设,内部时钟速度等)。

对于如何做的指导文章、帖子等的任何指针将不胜感激。到目前为止,我还没有找到关于我的开发板的分步教程:((

提前谢谢!

祝好,
Iliyan

我尝试创建一个新项目,它编译并运行,但LED没有亮起。
显然在代码中缺少一些重要的部分。

英文:

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.

答案1

得分: 0

MPLAB Harmony V3 Framework 包括应用软件示例和驱动程序库。在 MPLAB IDE 的 'Tools' 选项卡下添加 Harmony 到 'Embedded'。

英文:

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.

huangapple
  • 本文由 发表于 2023年2月19日 01:36:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/75495163.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定