View previous topic :: View next topic |
Author |
Message |
manikya
Joined: 10 Apr 2007 Posts: 4
|
including lcd.c file |
Posted: Sun Apr 22, 2007 12:26 pm |
|
|
Hi
Hope someone can help me with a file linking problem. I am using MPLAB 7.5 ide with CCS C compiler selected in tool language option.
I have a main program temp.c which starts like;
#include<16F877.H>
#define on 1
#define off 0
#fuses hs,nowdt,noprotect,noput
#Device adc=10
#use delay(clock=11052900)
#include<temp_lcd.c>
int8 count,temp_loc;
int16 raw_temp;
when compiled it reaches for the temp_lcd.c first then throws lot of undefined functions errors. The temp_lcd.c is a slightly modified version of an flex_lcd_drvr.c driver which I copied from one of forum topics. I have looked up elsewhere in the forum, didnt find an answer that I understand.
Do I have to have a temp_lcd.h file too for compilation to succede? and how to make a .h file when only a .c file is available? I tried to rename the temp_lcd.c to temp_lcd.h and included it in the header directory. It did not help.
I have tried to put this in the other files folder of the mplab project window with no success. The so called flex_lcd_drvr.c needs to be edited to have a main() and make it a stand alone c routine? I am new to this pic's , so my question might look silly! thanx in advance |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Apr 22, 2007 1:15 pm |
|
|
In MPLAB, you should only add the main C source to the MPLAB project.
Don't add all the driver C files to the MPLAB project. All the driver
files should only be referenced with an #include statement in the main
source file.
See this post for links to examples:
http://www.ccsinfo.com/forum/viewtopic.php?t=29696&start=6 |
|
|
manikya
Joined: 10 Apr 2007 Posts: 4
|
|
Posted: Sun Apr 22, 2007 6:01 pm |
|
|
Hi PCM PROGRAMMER
I had infact read those posts of yours upon keyword search. I have tried adding only the main source file in source directory and the device header 16f877.h in the headers directory of mplab project window. It still throws up lot of undefined's errors;
Executing: "C:\Program Files\PICC\Ccsc.exe" "temp.c" +FM +DF +LN +T -A +M +Z +Y=9 +EA
*** Error 12 "C:\MPLAB_projects\temperature\temp_lcd.c" Line 30(8,21): Undefined identifier lcd_wr_nibble
*** Error 12 "C:\MPLAB_projects\temperature\temp_lcd.c" Line 34(5,18): Undefined identifier lcd_wr_nibble
*** Error 12 "C:\MPLAB_projects\temperature\temp_lcd.c" Line 38(5,16): Undefined identifier lcd_wr_byte
and the error list goes further!
Should it compile with just the main prog added in the project source and the device header in the project header dir? (with #include <lcd.c> which did not work anyway) What am I doing wrong? Do you want me to list the flex_lcd_drvr.c file? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Apr 22, 2007 6:10 pm |
|
|
Quote: |
*** Error 12 "C:\MPLAB_projects\temperature\temp_lcd.c" Line 30
(8,21): Undefined identifier lcd_wr_nibble |
I searched the forum for "lcd_wr_nibble". I also did a web search
and I searched all the CCS compiler directories, and I couldn't find
that identifier anywhere.
That's probably the problem. I don't know what driver you're using. |
|
|
manikya
Joined: 10 Apr 2007 Posts: 4
|
|
Posted: Sun Apr 22, 2007 6:48 pm |
|
|
Hi,
I found the file at
http://www.ccsinfo.com/forum/viewtopic.php?t=24661&highlight=lcd+driver
Turns out it was posted by you!! Flexible_lcd.c is the file you had posted there. I had gone through the file and tried to recreate the same without peaking much into your original(I am learning!) by referring to the lcd module data sheet. Hence the function names have changed. I want to display temperature from an RTD on this 16X2 lcd. I am still stuck with a project that doesnt compile. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Apr 22, 2007 6:52 pm |
|
|
Quote: | I had gone through the file and tried to recreate the same without peaking much into your original |
Use the file intact ! That's what it's there for. |
|
|
manikya
Joined: 10 Apr 2007 Posts: 4
|
|
Posted: Sun Apr 22, 2007 11:22 pm |
|
|
It compiles without error with the original include file flex_lcd!
I had added a function to turn backlight on or off and a routine to clear the screen. Seems like the changed order of the functions appearing in the header file was causing those errors. Thanks PCM Programmer |
|
|
|