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

Error#112 Function used but not defined: ... delay_ms 446

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



Joined: 23 Jan 2018
Posts: 4
Location: SPAIN

View user's profile Send private message

Error#112 Function used but not defined: ... delay_ms 446
PostPosted: Tue Jan 23, 2018 10:37 am     Reply with quote

Hello, I introduce myself.
My name is Alberto. I'm a spanish mechatronics engineer and I guess I must be driving myself insane.
First of all excuse my english. I'm learning too :-)
I am trying to debug a program in a PIC16F887 with MPLAB IDE X by CCS.

I've added the 16f887.h file to the project/header_files and I've added too the LCD driver to the object files. The main program is in the Source folder. Well.

I included the header file in the *.c docs but the compiler doesn't recognize the function delay_ms in the LCD driver but there isn't problems in the main file with this delay.


MAIN.C
Code:

#include <16F887.h>
#use delay (clock=4000000)
#include "LCD_pc1602f.c"

#use fast_io(A)
#use fast_io(B)

#fuses INTRC,NOWDT,PUT,BROWNOUT,NOPROTECT,NOLVP,NOCPD,NOWRT


What can I try?
B3RT86



Joined: 23 Jan 2018
Posts: 4
Location: SPAIN

View user's profile Send private message

Error#128 A #DEVICE required before this line
PostPosted: Tue Jan 23, 2018 10:56 am     Reply with quote

If I don´t #include the header file in the LCD driver.c. I get this error Error#128 A #DEVICE required before this line.
I choose my device in the header file. I don´t know what´s wrong :'-|
PCM programmer



Joined: 06 Sep 2003
Posts: 20402

View user's profile Send private message

PostPosted: Tue Jan 23, 2018 11:11 am     Reply with quote

Quote:
I am trying to debug a program in a PIC16F887 with MPLAB IDE X by CCS.

CCS has a tutorial that shows how to setup a CCS project in MPLAB X.
https://www.ccsinfo.com/pdfs/mplabx_ccs_tutorial.pdf
B3RT86



Joined: 23 Jan 2018
Posts: 4
Location: SPAIN

View user's profile Send private message

PostPosted: Tue Jan 23, 2018 12:16 pm     Reply with quote

Yes, thx. i read it months ago, I hadn't had problems in the others projects but now it become insane.
PCM programmer



Joined: 06 Sep 2003
Posts: 20402

View user's profile Send private message

PostPosted: Tue Jan 23, 2018 12:24 pm     Reply with quote

But you are doing weird stuff like this:
Quote:
I've added too the LCD driver to the object files


CCS has a way to link object files. It's called Multiple Compilation Units.
But it's only available with the CCS IDE version of the compiler.
Using MPLAB-X, you don't use object files. Don't add them to any folder
in MPLAB-X. Only use source .c files.

Also, don't add lcd driver files to any folder in the MPLAB-X project
window. Just have an #include line for the lcd source file in your
main C source file.

Also, don't add the 16F887.h file to every driver file that you have.
There should only be an #include line for 16F887.h at the start of your
main C source file.

Don't start randomly adding files to various MPLAB-X folders. Just have
your main C source file in the "Source files" folder in the MPLAB-X project
window. Don't put anything in "Header files".
B3RT86



Joined: 23 Jan 2018
Posts: 4
Location: SPAIN

View user's profile Send private message

BUILD SUCCESSFUL
PostPosted: Tue Jan 23, 2018 1:05 pm     Reply with quote

Very Happy Very Happy At first I only agree the Header file and the LCD driver just as i learned. The weird things came when it didn't work like that and i started to try ways Rolling Eyes Rolling Eyes Rolling Eyes

Thank you so much!! Laughing
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