Recently, I suddenly remembered that I had learned pic, and I had nothing to worry about in the morning. I was planning to review it! Microchip has just released a new mplab x IDE development environment. It is said that it has won any innovation awards, but unfortunately it is praised by hardware engineers for their spam and other words. Try it by yourself.
Install and open the interface.
After opening it, it will also be dazzling
Problems occurred during project Creation
I cannot create a project from the start page. Why?
Create a test project from File
Enter the code:
# Include <PIC. h >__ config (XT & wdtdis & lvpdis); // define the configuration word, crystal oscillator type: XT, disable open dog, disable low-voltage programming void main () {trisc = 0x00; portc = 0xf0; while (1 ){}}
Compilation. The problem arises.
Make-F nbprojects/Makefile-default.mk subprojects =. Build-Conf
Make [1]: Entering directory 'G:/mplab/test. X'
Make-F nbproject/Makefile-default.mk Dist/default/production/test. X. Production. HEX
Make [2]: Entering directory 'G:/mplab/test. X'
"D: \ Program Files (x86) \ HI-TECH SOFTWARE \ PICC \ 9.83 \ bin \ picc.exe"-odist/default/production/test. x. production. cof-mdist/default/production/test. x. production. map -- Summary = default,-keep CT,-class, + MEM,-hex -- chip = 16f877-p -- runtime = default, + clear, + init,-keep, + osccal, -resetbits,-download,-stackcall, + cLib -- Summary = default,-keep CT,-class, + MEM,-hex -- opt = default, + ASM,-asmfile, -Speed, + space,-debug, 9-n31 -- Warn = 0 -- double = 24 -- float = 24 -- addrqual = ignore -- mode = lite -- output = default, -inhx032-g -- asmlist "-- errformat = % F: % L: Error: % s" "-- msgformat = % F: % L: Advisory: % s "" -- warnformat = % F: % L warning: % s "build/default/production/newmain. p1
HI-TECH C compiler for pic10/12/16 MCUs (lite mode) v9.83
Copyright (c) 2011 microchip technology Inc.
Serial number: HCPICP-123456 (Pro)
Make [2]: *** [Dist/default/production/test. X. Production. HEX] Error 1
C: \ Users \ �� \ appdata \ Local \ temp \ s4bo.: 45: Error: Undefined symbol "lvpdis"
C: \ Users \ �� \ appdata \ Local \ temp \ s4bo.: 45: Error: Undefined symbol "wdtdis"
C: \ Users \ �� \ appdata \ Local \ temp \ s4bo.: 45: Error: Undefined symbol "XT"
Make [2]: Leaving directory 'G:/mplab/test. X'
Make [1]: Leaving directory 'G:/mplab/test. X'
Make [1]: *** [. Build-conf] Error 2
Make: *** [. Build-impl] Error 2
Build failed (exit value 2, total time: 1 s)
In short, it is a failure! Two more errors !!!
Is the level reduced? Just a few lines, this is the original code that runs correctly, and it cannot be wrong.
Troubleshooting, undefined Constants
Error: Undefined symbol "lvpdis"
Error: Undefined symbol "wdtdis"
Undefined symbol "XT"
Open the hi tech folder, and find the pic. h file and PIC16F877. h file.
Constant definition changed
// Config Register: CONFIG#define CONFIG 0x2007// Oscillator Selection bits// RC oscillator#define FOSC_EXTRC 0xFFFF// HS oscillator#define FOSC_HS 0xFFFE// XT oscillator#define FOSC_XT 0xFFFD// LP oscillator#define FOSC_LP 0xFFFC// Watchdog Timer Enable bit// WDT enabled#define WDTE_ON 0xFFFF// WDT disabled#define WDTE_OFF 0xFFFB// Power-up Timer Enable bit// PWRT disabled#define PWRTE_OFF 0xFFFF// PWRT enabled#define PWRTE_ON 0xFFF7// FLASH Program Memory Code Protection bits// Code protection off#define CP_OFF 0xFFFF// 1F00h to 1FFFh code protected#define CP_UPPER_256 0xEFEF// 1000h to 1FFFh code protected#define CP_HALF 0xDFDF// 0000h to 1FFFh code protected#define CP_All 0xCFCF// Brown-out Reset Enable bit// BOR enabled#define BOREN_ON 0xFFFF// BOR disabled#define BOREN_OFF 0xFFBF// Low Voltage In-Circuit Serial Programming Enable bit// RB3/PGM pin has PGM function; low-voltage programming enabled#define LVP_ON 0xFFFF// RB3 is digital I/O, HV on MCLR must be used for programming#define LVP_OFF 0xFF7F// Data EE Memory Code Protection// Code Protection off
Some examples
Original code changed
# Include <PIC. h >__ config (fosc_xt & wdte_off & lvp_off); // define the configuration word, crystal oscillator type: XT, close the opening dog, disable low-voltage programming void main () {trisc = 0x00; portc = 0xf0; while (1 ){}}
Compilation successful, good.
Later, we finally found that the version of PICC is different, and the constant definition is different. Do your homework before you prepare for the operation. Otherwise ......, A few small issues have plagued me for one morning. I wrote down the issue, warning and memo.