View previous topic :: View next topic |
Author |
Message |
B3RT86
Joined: 23 Jan 2018 Posts: 4 Location: SPAIN
|
Error#112 Function used but not defined: ... delay_ms 446 |
Posted: Tue Jan 23, 2018 10:37 am |
|
|
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
|
Error#128 A #DEVICE required before this line |
Posted: Tue Jan 23, 2018 10:56 am |
|
|
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: 21708
|
|
|
B3RT86
Joined: 23 Jan 2018 Posts: 4 Location: SPAIN
|
|
Posted: Tue Jan 23, 2018 12:16 pm |
|
|
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: 21708
|
|
Posted: Tue Jan 23, 2018 12:24 pm |
|
|
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
|
BUILD SUCCESSFUL |
Posted: Tue Jan 23, 2018 1:05 pm |
|
|
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
Thank you so much!! |
|
|
|