大家好,我是菜鸟,我知道。所以在这里,我在MPLAB X IDE 3.30中创建了一个程序,并使用pickit 2和独立pickit 2程序版本2.61将十六进制文件下载到芯片中。当模拟器运行代码时,PIC没有响应。因此我创建了一个测试程序,它应该放在一个LED(RB15)上,并且我尝试了不同的配置设置。led RB15实际上没有打开,但是有些东西似乎正在运行芯片,因为OSCO或RA3使用t他设置了CK0。所有其他GPIO引脚读出大约0.2到0.5伏,有时根据杂散电容而稍微低或更高(比如在设备附近挥动我的手)。右边我有一个MCLR线到VDD(@3.3V),当我试图运行它,我还使用高压编程模式来编译MCLR,这给出了t同样的结果和另一个免费的(但是没有用的)GPIO引脚。这是我用于测试程序的源代码:我确实理解微芯片不想让我用这个pic24f04ka200的pickit 2,尽管我从一个朋友那里借用了这个来降低项目成本。我只是在太晚的时候才发现MPLAB使用pickit 3。有没有我忽略的设置或者一些特殊的要求来阻止像我这样的小伙子进来;)哈哈?我非常感谢任何帮助!问候,JP
以上来自于百度翻译
以下为原文
Hello all,
I am the noob, I know right.
So here is the thing, I created a program in MPLAB X IDE 3.30 and downloaded the hex file to the chip using pickit 2 and the standalone pickit 2 program version 2.61. The PIC doesn't respond while the simulator runs the code just fine.
So I created a test program which is supposed to put on a led (RB15) and I tried different configura
tion settings.
The led RB15 doesn't actually turn on, however something seems to run the chip since OSCO or RA3 does turn on using the CLK0 setting. All other GPIO pins read about 0.2 to 0.5 volts, sometimes slightly lower or higher depending on stray capacitance (like waving my hand near the device).
O right I have the MCLR wired to VDD (@3.3V) when I try to run it, I have also used high voltage programmer mode to ommit the MCLR and this gave the same results and another free (yet useless) GPIO pin.
Here is the source code I used for a test program:
#include
#include
// PIC24F04KA200 Configuration Bit Settings
// 'C' source line config statements
#include
// FBS
// FGS
#pragma config GWRP = OFF // General Segment Code Flash Write Protection bit (General segment may be written)
#pragma config GCP = OFF // General Segment Code Flash Code Protection bit (No protection)
// FOSCSEL
#pragma config FNOSC = FRC // Oscillator Select (Fast RC oscillator (FRC))
#pragma config IESO = OFF // Internal External Switch Over bit (Internal External Switchover mode disabled (Two-Speed Start-up disabled))
// FOSC
#pragma config POSCMOD = NONE // Primary Oscillator Configuration bits (Primary oscillator disabled)
#pragma config OSCIOFNC = ON // CLKO Enable Configuration bit (CLKO output disabled)
#pragma config POSCFREQ = HS // Primary Oscillator Frequency Range Configuration bits (Primary oscillator/external clock input frequency greater than 8 MHz)
#pragma config SOSCSEL = SOSCHP // SOSC Power Selection Configuration bits (Secondary oscillator configured for high-power operation)
#pragma config FCKSM = CSDCMD // Clock Switching and Monitor Selection (Clock switching is disabled, Fail-Safe Clock Monitor is disabled)
// FWDT
#pragma config WDTPS = PS32768 // Watchdog Timer Postscale Select bits (1:32,768)
#pragma config FWPSA = PR128 // WDT Prescaler (WDT prescaler ratio of 1:128)
#pragma config WINDIS = OFF // Windowed Watchdog Timer Disable bit (Standard WDT selected; windowed WDT disabled)
#pragma config FWDTEN = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
// FPOR
#pragma config BOREN = BOR0 // Brown-out Reset Enable bits (Brown-out Reset disabled in hardware; SBOREN bit disabled)
#pragma config PWRTEN = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BORV = LPBOR // Brown-out Reset Voltage bits (Low-Power Brown-out reset occurs around 2.0V)
#pragma config MCLRE = ON // MCLR Pin Enable bit (MCLR pin enabled; RA5 input pin disabled)
// FICD
#pragma config ICS = PGx2 // Reserved (PGC2/PGD2 are used for programming the device)
// FDS
#pragma config DSWDTPS = DSWDTPSF // Deep Sleep Watchdog Timer Postscale Select bits (1:2,147,483,648 (25.7 Days))
#pragma config DSLPBOR = OFF // Deep Sleep Zero-Power BOR Enable bit (Deep Sleep BOR disabled in Deep Sleep)
#pragma config DSWDTEN = OFF // Deep Sleep Watchdog Timer Enable bit (DSWDT disabled)
/*
*/
int main(void)
{
TRISA = 0xFFFF;
TRISB = 0x0000;
AD1PCFG = 0xFFFF;
while(1)//program loop
{
PORTBbits.RB15 = 1;
}
return (EXIT_SUCCESS);
}
I do understand that microchip does not want me to use the pickit 2 for this pic24f04ka200, although I borrowed this from a friend to reduce project costs. I only found out MPLAB uses pickit 3 when it was too late.
Is there a setting which I have overlooked or some special requirements to keep noobs like me out ;) haha?
I would very much appreciate any help!
Regards,
JP
0