Lỗi dịch Mplab!

nganphuocnguyen

Trứng gà
Sau khi tạo project và buid thì nó báo 1 đống lỗi như sau.

uild F:\Pic\project2\nganphuoc2 for device 16F887
Using driver C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe

Make: The target "F:\Pic\project2\nganphuoc2.p1" is out of date.
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" --pass1 F:\Pic\project2\nganphuoc2.c -q --chip=16F887 -P --runtime=default --opt=default -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" -onganphuoc2.cof -mnganphuoc2.map --summary=default --output=default nganphuoc2.p1 --chip=16F887 -P --runtime=default --opt=default -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83
Copyright (C) 2011 Microchip Technology Inc.
(1273) Omniscient Code Generation not available in Lite mode (warning)
Error [800] nganphuoc2.as; 45. undefined symbol "DEBUGDIS"
Error [800] nganphuoc2.as; 45. undefined symbol "LVPDIS"
Error [800] nganphuoc2.as; 45. undefined symbol "FCMDIS"
Error [800] nganphuoc2.as; 45. undefined symbol "IESODIS"
Error [800] nganphuoc2.as; 45. undefined symbol "SWBOREN"
Error [800] nganphuoc2.as; 45. undefined symbol "UNPROTECT"
Error [800] nganphuoc2.as; 45. undefined symbol "MCLREN"
Error [800] nganphuoc2.as; 45. undefined symbol "PWRTEN"
Error [800] nganphuoc2.as; 45. undefined symbol "WDTDIS"
Error [800] nganphuoc2.as; 45. undefined symbol "XT"
Error [800] nganphuoc2.as; 49. undefined symbol "BORV21"

********** Build failed! **********
mong các huynh tỉ muội có kinh nghiệm giúp đỡ giùm cho em!
em có đính kém theo files luôn nè!
 

Attachments

Manhdd

Cố Vấn CLB
Staff member
Lỗi undefined ở phiên bản mới, bạn chịu khó tìm trước khi post bài. Xem file đính kèm preprocessors note ở Bài tập buổi 4 - C5.
 

nickcat

Gian thương PIF
e bị cái lỗi này a mạnh ơi
Code:
Build C:\Users\Administrator\Downloads\C5\BT 5\PIC\test for device 16F877
Using driver C:\Program Files\HI-TECH Software\PICC\9.83\bin\picc.exe

Make: The target "C:\Users\Administrator\Downloads\C5\BT 5\PIC\Timer0.p1" is out of date.
Executing: "C:\Program Files\HI-TECH Software\PICC\9.83\bin\picc.exe" --pass1 "C:\Users\Administrator\Downloads\C5\BT 5\Tutorials3-12\Timer0.c" -q --chip=16F877 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error   [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s" 
Error   [192] C:\Users\Administrator\Downloads\C5\BT 5\Tutorials3-12\Timer0.c; 50.1 undefined identifier "ANSEL"
Error   [192] C:\Users\Administrator\Downloads\C5\BT 5\Tutorials3-12\Timer0.c; 51.1 undefined identifier "ANSELH"
Theo tra trên google thì do lỗi config mà hok biết config thế nào mới đúng ??

Code:
#include <htc.h>
__CONFIG(XT & WDTDIS & PWRTEN & MCLREN & UNPROTECT & SWBOREN & IESODIS & FCMDIS & LVPDIS & DEBUGDIS); //1st config. Word

__CONFIG(BORV21); //2st config. Word

#define _XTAL_FREQ 	4000000 //Crystal frequency
Cái config giống của a thì cũng ko chạy luôn, e xài IDE 8.8, trình dịch là hi-tech 9.83 @@, điên thiệt. ecũng coi cái file processernote rồi cũng thử config giống nó mà cũng cóc chạy @@, mở file pic16f887.h ra thì chả biết gì luôn
 

Manhdd

Cố Vấn CLB
Staff member
hi-tech mới nhỉ :d.
cả ANSEL và ANSELH cũng không có định nghĩa thì hơi lạ đó (google cho thấy không có lỗi kiểu này), project của bạn có thiếu cái gì không ta (như include htc.h) ??
pic16f887.h chứa tất cả những định nghĩa rồi, chắc là bạn search chữ ANSEL là có đó.
 

ndhq_dd10

Trứng gà
Còn em thì gặp cái lỗi này:
Make: The target "D:\pic projet\proj1\main_timer.p1" is up to date.
Executing: "C:\Program Files\HI-TECH Software\PICC\9.82\bin\picc.exe" -otimer0.cof -mtimer0.map --summary=default --output=default main_timer.p1 --chip=16F887 -P --runtime=default --opt=default -D__DEBUG=1 --rom=default --ram=default -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.82
Copyright (C) 2011 Microchip Technology Inc.
(1273) Omniscient Code Generation not available in Lite mode (warning)
Error [141] ; . can't open runtime startup file "startup.as": Permission denied

Không biết đây là lỗi gì, cái chương trình mẫu mấy anh gửi qua mail em sửa lại phần config cho hợp phiên bản rồi vẫn bị lỗi như thế hichic
 

Manhdd

Cố Vấn CLB
Staff member
Lỗi lạ quá =.= . Bạn đưa nguyên project lên đây cho mọi người xem đi!
 

nguyentandong92

Thành Viên PIF
Lỗi lạ quá =.= . Bạn đưa nguyên project lên đây cho mọi người xem đi!
Đây anh Mạnh ơi:
/****************************************************************
*
* www.payitforward.edu.vn
*
****************************************************************/
/****************************************************************
*
* PIC Training Course
*
****************************************************************/

/****************************************************************
*
* Module : Timer0.c
* Description : Blink led every 1s
* Tool : HI-TECH PIC
* Chip : 16F887
* History : 03/12/2011
*
* Author : Nguyen Tien Manh, PIF
* Notes :
*
*
****************************************************************/


/****************************************************************
* IMPORT
****************************************************************/

#include <htc.h>
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & MCLRE_ON & CP_OFF & BOREN_OFF & IESO_OFF & FCMEN_OFF & LVP_OFF & DEBUG_OFF); //1st config. Word

__CONFIG(BOR4V_BOR21V); //2st config. Word

#define _XTAL_FREQ 4000000 //Crystal frequency


/*****************************************************************
GLOBAL VARIABLE
******************************************************************/
unsigned int counter = 0;

/*****************************************************************
* ROUTINES
******************************************************************/

void port_init(void)
{
ANSEL=0;
ANSELH=0; //All ports (0 to 13) are digital
TRISB=0x00; //8 pins PortB are output
//TRISA4=1; // RA4 - T0CKI (Timer 0 Clock Input) is ready for input
PORTB=0x00; //8 pins PortB are digital 0 (leds is on)
}

void timer0_init()
{
// ** Timer0 Setting
T0CS = 0; // T0 Clock Source '0/1 internal/external'
//T0SE = 0 ; //T0 Source Edge 0: low2high transition on T0CKI pin
PSA = 0; // Prescale Assignment '1/0 WDT/T0'
// (set 1 when not use prescaler for timer 0)
// PS Prescale Rate Select
PS2 = 1;
PS1 = 1;
PS0 = 1;
// 1 : 256 //
TMR0 = 0; // T0 Module Register (initial value)
// Config interrupt for Timer0
GIE = 1; // Gobal Interrupt Enable
T0IE = 1; //T0 Interrupt Enable
T0IF = 0; // T0 Interrupt Flag 'On/off 1/0'(default is 1)
}


void interrupt isr() // interrupt service rountine
{
/* Explanation:
Machine Circle is: 1/(FOSC/4) = 1/(4 Mhz/4) = 1 us
Because TMR0 = 0 and prescale is 1: 256, T0 overfow (interrupt)
every 1us*256*256 = 65536 us
To get 1s, we must have 1s/65536us = 15 times interrupt
*/
if (T0IF && T0IE) //Interrupt Flag is on
{
if (counter==15)
{
counter = 0; // reset counter
PORTB ^= 0xFF; // Invert all leds on PORTB
}
counter++;
T0IF = 0; // pull down interrupt flag
TMR0 = 0; // reset T0
}
}

/****************************************************************
* MAIN
****************************************************************/

void main(void)
{
timer0_init();
port_init();
__delay_ms (10); // Delay for configuration above
while(1)
{
//...Code for main program here
};

}

/****************************************************************
* END OF Timer0.c
****************************************************************/

Anh cũng thấy rồi đó, không khác chương trình mấy anh gửi là bao mà nó báo lỗi ,hic
 

Manhdd

Cố Vấn CLB
Staff member
mình build bình thường mà, có sao đâu, bạn gửi nguyên project xem.
 

nguyentandong92

Thành Viên PIF
Hic, không lẽ cái MPLAB của em nó bị lỗi rồi. Điên với nó ghê, đã không hiện dc cửa sổ output lại còn bị mắc lỗi build nữa :(
Project nè anh
 

Attachments

Top