This is the error log that i am getting
Code:Clean: Deleting intermediary and output files. Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\lcd.p1". Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\main_prog.p1". Clean Warning: File "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.cof" doesn't exist. Clean Warning: File "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.hex" doesn't exist. Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.sym". Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.map". Clean Warning: File "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.hxl" doesn't exist. Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\startup.lst". Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\startup.rlf". Clean Warning: File "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\doprnt.p1" doesn't exist. Clean Warning: File "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\doprnt.pre" doesn't exist. Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.obj". Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.lst". Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.rlf". Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.sdb". Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd.mcs". Clean: Done. Build C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd for device 16F877A Using driver C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" --pass1 C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\lcd.c -q --chip=16F877A -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" Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" --pass1 C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\main_prog.c -q --chip=16F877A -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" Warning [361] C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\main_prog.c; 12.1 function declared implicit int Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" -otest_program_lcd.cof -mtest_program_lcd.map --summary=default --output=default lcd.p1 main_prog.p1 --chip=16F877A -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" HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.81 Copyright (C) 2010 Microchip Technology Inc. (1273) Omniscient Code Generation not available in Lite mode (warning) [COLOR="#FF0000"]Error [500] ; 0. undefined symbols: _lcd_init(test_program_lcd.obj) _lcd_clear(test_program_lcd.obj) ___delay_ms(test_program_lcd.obj) [/COLOR] ********** Build failed! **********
Means I will not be able to make my own header file without using the Command Line Option
6.2 LIBRARIAN
The librarian program, LIBR, has the function of combining several files into a single file known
as a library. The reasons you might want to use a library in a project are:
• there will be fewer files to link
• the file content will be accessed faster
• libraries uses less disk space
The librarian can build p-code libraries (.lpp extension) from p-code files (.p1 exten- sion), or
object code libraries (.lib extension) from object files (.obj extension).
P-code libraries should be only created if all the library source code is written in C. Object code
libraries should be used for assembly code that is to be built into a library.
With both library types, only those modules required by a program will be extracted and included in
the program output.
6.2.1 The Library Format
The modules in a library are simply concatenated, but a directory of the modules and symbols in the
library is maintained at the beginning of a library file. Since this directory is smaller than the
sum of the modules, on the first pass the linker can perform faster searches just reading the
directory, and not all the modules. On the second pass it need read only those modules which are
required, seeking over the others. This all minimizes disk I/O when linking.
It should be noted that the library format is not a general purpose archiving mechanism as is used
by some other compiler systems. This has the advantage that the format may be optimized toward
speeding up the linkage process.
may be optimized toward speeding up the linkage process.
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\lcd.p1".
Clean Warning: File "C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\main_prog.p1" doesn't exist.
Clean: Done.
Build C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\test_program_lcd for device 16F877A
Using driver C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe
Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" --pass1 C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\lcd.c -q --chip=16F877A -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"
Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" --pass1 C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\main_prog.c -q --chip=16F877A -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"
Warning [361] C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\main_prog.c; 6.1 function declared implicit int
Warning [361] C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\main_prog.c; 8.1 function declared implicit int
Warning [361] C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\main_prog.c; 10.1 function declared implicit int
Executing: "C:\Program Files\HI-TECH Software\PICC\9.81\bin\picc.exe" -otest_program_lcd.cof -mtest_program_lcd.map --summary=default --output=default lcd.p1 main_prog.p1 C:\Users\SHARMA\Documents\MPLAB_Projects\LCD_Header_File_Test\lcd.lib --chip=16F877A -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"
HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.81
Copyright (C) 2010 Microchip Technology Inc.
(1273) Omniscient Code Generation not available in Lite mode (warning)
Error [380] ; . unknown record type (114)
********** Build failed! **********
void lcd_init([COLOR="#FF0000"]void[/COLOR]);
void lcd_init([COLOR="#FF0000"]unsigned char value[/COLOR])
{
lcd_cmd(0x38);
lcd_cmd(0x0E);
lcd_cmd(0x01);
lcd_cmd(0x06);
lcd_cmd(0x80);
}
#define _XTAL_FREQ 20000000
// Comment macro to ignore a function from the build
#define _LCD_INIT
#define _LCD_CLEAR
#define _LCD_DATA_STRING
#define _LCD_FIRST_ROW
#define _LCD_SECOND_ROW
#ifndef __LCD_H__
#define __LCD_H__
//This is not good practice. I defined them here to keep your format.
#define _XTAL_FREQ 20000000
#define LCD_DATA PORTB
#define RS PORTCbits.RC0
#define RW PORTCbits.RC1
#define EN PORTCbits.RC2
#ifdef _LCD_INIT
extern void lcd_init(void);
#endif
#ifdef _LCD_CLEAR
extern void lcd_clear(void);
#endif
#ifdef _LCD_DATA_STRING
extern void lcd_data_string(unsigned char msg[]);
#endif
#ifdef _LCD_FIRST_ROW
extern void lcd_first_row(void);
#endif
#ifdef _LCD_SECOND_ROW
extern void lcd_second_row(void);
#endif
#endif // __LCD_H__
/*All LCD Functions Definitions*/
#include<htc.h>
#include<string.h>
#include"lcd.h"
static void lcd_cmd(unsigned char value)
{
LCD_DATA = value;
RS = 0;
RW = 0;
EN = 1;
__delay_ms(1);
EN = 0;
}
static void lcd_data(unsigned char value)
{
LCD_DATA = value;
RS = 1;
RW = 0;
EN = 1;
__delay_ms(1);
EN = 0;
}
#ifdef _LCD_INIT
void lcd_init(unsigned char value)
{
lcd_cmd(0x38);
lcd_cmd(0x0E);
lcd_cmd(0x01);
lcd_cmd(0x06);
lcd_cmd(0x80);
}
#endif
#ifdef _LCD_CLEAR
void lcd_clear(void)
{
lcd_cmd(0x01); //Clears The LCD
}
#endif
#ifdef _LCD_DATA_STRING
void lcd_data_string(unsigned char msg[])
{
unsigned int j,len;
len = strlen(msg);
for(j=0;j<len;j++)
{
lcd_data(msg[j]);
}
}
#endif
#ifdef _LCD_FIRST_ROW
void lcd_first_row(void)
{
lcd_cmd(0x80);
}
#endif
#ifdef _LCD_SECOND_ROW
void lcd_second_row(void)
{
lcd_cmd(0xC0);
}
#endif
#include<htc.h>
#include"lcd.h"
void main()
{
lcd_init();
__delay_ms(100);
lcd_clear();
while(1);
// lcd_data_string("Arun Sharma");
}
#define _LCD_INIT
#define _LCD_CLEAR
#define _LCD_DATA_STRING
#define _LCD_FIRST_ROW
#define _LCD_SECOND_ROW
Not exactly. The first case is the function prototype. If you are using strict ANSI C compiler, then without this an error will be thrown. The second case is not compiler dependent. It is obligatory to write this line if you want to call that function from another line. However, there is a more optimum way to achieve this. If you have a header file where the prototype is placed, then this header could be included by the files that intend to call this function. Then there is no need for external call, just include the header file and call this function freely.arunsharma0731 said:void lcd_init();
is same as
extern void lcd_init();
am i right...
I wouldn't go with this macro method you are using. I would just comment out whatever is not needed, like I pointed out in post #9. You are maybe enthousiastic about it at the moment because it finally worked (congrats by the way), but you will soon find out that for bigger projects this will be a dirty solution. Today you have your lcd functions. Tomorrow you will write functions for relay, LEDs etc. For each new function you will create, a corresponding macro will be introduced. This is messy, your header files will be difficult to read, and their size will be way bigger than they should be. If you insist in the macro method, then you will just comment out the functions that are not needed for this project.arunsharma0731 said:if i am calling lcd_init()
function then code related to that must include in my code memory...
#define _LCD_INIT
#define _LCD_CLEAR
#define _LCD_DATA_STRING
#define _LCD_FIRST_ROW
//#define _LCD_SECOND_ROW
I had used MikroC compiler earlier...
these compilers have many functions for various devices...
And We are not able to see the code behind each functions ...
and let us suppose i am using LCD Library of that Compiler
suppose i need to just include Lcd_Init() functions
So it means that
when i call that function it means that all the code associated with that library will gets included
i am saying this because we have not to comment out any statement or any macros there..
I don't know...
Or there is some other way to do so...
I am confused..
With both library types, only those modules required by a program will be extracted and included in the program output.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?