[PIC] Error on MPLAB compiling

Status
Not open for further replies.

ZonGzAi

Newbie level 3
Joined
Jul 20, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
32
i'm newbie for MPLAB X...now i facing the problem and donno how to solve it...
below is my programming header files.
Code:
"#include <as16F877.h>
#include<pic.h>
#ifndef _AS16F877_H_
#define _AS16F877_H_
#include <xc.inc>
#endif // _AS16F877_H_"

any dear friend can help me???thank you very much...

 
Last edited by a moderator:

xc.inc is usually xc.h and you don't normally have to include the processor header as well.

Without knowing what is inside 'as16F877.h' it's impossible to see if it contains any errors. In the message:
C:\Program Files (x86)\Microchip\xc8\v1.31\include\pic16f877.inc:13 6: error: (223) digit out of range
the (223) is the line number containing the error, please look at that line and let us know what it contains. Incidentally, the quote marks around the header should not be there.

Brian.
 

Hi Brian.Thanks for your reply.I had change the programming as u say xc.inc to xc.h, and i also cancel the include the processor as shown below


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include<pic.h>
#include <xc.h>
#include<htc.h>
#define RS RE0
#define RW RE1
#define EN RE2
#define DATA PORTB
 
void LCD_CMD(unsigned int value);
void LCD_DAT(unsigned int value);
void delay();
 
 
int main(void)
{
    ADCON0 = 0x00;//Disable ADC ports
    ADCON1 = 0x06;//Disable ADC ports
 
    TRISE =0x00;
    TRISB =0x00;
    //DATA=0x01;
    LCD_CMD(0x01);
    delay ();
    LCD_CMD(0x38);
    delay ();
    LCD_CMD(0x0F);
    delay ();
   // LCD_CMD(0x07);
    delay();
    LCD_CMD(0x06);
    delay ();
    LCD_CMD(0x0c);
    delay ();
 
 
    LCD_CMD(0x80);
    delay ();
 
    //DATA='A';
    LCD_DAT('S');
    LCD_DAT('E');
    LCD_DAT('R');
    LCD_DAT('V');
    LCD_DAT('4');
    LCD_DAT('U');
 
    LCD_CMD(0x80);
     while(1);
    return (0);
 
}
 
void LCD_CMD(unsigned int value)
{
    DATA =value;
    RS=0;
    RW=0;
    EN=1;
    delay ();
    EN=0;
    delay ();
 }
 
void LCD_DAT(unsigned int value)
{
    DATA=value;
    RS=1;
    RW=0;
    EN=1;
    delay ();
    EN=0;
    delay();
 
}
 
void delay(void)
{
    int counter = 0;
    for (counter = 0; counter<10000; counter++) {
        ;
    }
}



and after build, the report is


But my LCD cant display any word.The source code was download online and the developer mention that the source code can function.

Sorry for my broken English.^_^
 
Last edited by a moderator:

Code:
#include <xc.h>
this is enough for xc8 compiler.
 

Agreed, htc.h is for a different compiler altogether and may have conflicting definitions. I'm not sure what is in pic.h but it probably isn't needed either.

:: warning: (1273) Omniscient Code Generation not available in Free mode

is just Microchip's way of trying to persuade you to upgrade to their pro version, you can ignore it unless you need coptimized code and are rich!

I suspect your problem is with the delay routine. Each command needs different delays and you also need a long delay at the start for the LCD to initialize it's own processor before you can wrie anything to it at all. I think later versions of XC8 have delay routines built in so it would be worth checking them and using the values recommended in the LCD data sheet.

Brian.
 

Hi dear friends. Sorry for late reply.This few days i was out station, thank you for your information, i will try again in this weekend. Thank you very much ^_^
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…