CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

including lcd.c file

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
manikya



Joined: 10 Apr 2007
Posts: 4

View user's profile Send private message

including lcd.c file
PostPosted: Sun Apr 22, 2007 12:26 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 1:15 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 6:01 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 6:10 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 6:48 pm     Reply with quote

Smile 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

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 6:52 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Apr 22, 2007 11:22 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group