MPLAB IDE compiling error

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

Re: MPLAB IDE compiling error

Postby ober » Sat Dec 24, 2011 12:36 pm

TeoYX WROTE:when i write #include "i2c.c" and #include "i2c_rtc.c", below error come out:
Error [192] C:\Users\Teo Yu Xiang\VIP\PIC Program Testing\i2c.c; 116.8 undefined identifier "RW"
Error [192] C:\Users\Teo Yu Xiang\VIP\PIC Program Testing\i2c.c; 235.8 undefined identifier "RW"

Is that the proper way to use i2c.c instead of i2c.h? Any related post about this error when using real time IC? Please help. Thanks a lot.


OK, when you include in your main C file, you should be writting:
#include "i2c.h"
#include "i2c_rtc.h"

NOT the i2c.c file.
What I worry is you din not include the necessary files under project window. Project window is small window at the right top corner of MPLAB IDE which show what is the files (.c) being included under Source Files, and .h files under Header Files. Print screen and show it to us.

RW is a bit name under SSPCON1 or SSPCON2 for I2C. New Hitech compiler change the name to R_W. Don't ask me why they change it, I am sure about it 8-)

Anyway, as highlighted by Allen and Brian. Your code is too large, that is very obvious. Try comments some of the blocks (functions or statement) in your code. Is very difficult to debug a code which you integrate very thing at once. Even it can compiled, I am sure it is not what you want when you load into hardware, you will get problem troubleshooting it as you are not sure where is causing problem. We normally write code parts by parts, verifying a small portion of code working correctly and further add in new code, load into hardware check and verify the small portion of new code is working as we wanted. if it is not working we know the new added code is the problem, debug that portion only, not the whole code. Hope you get what I mean. :D
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: MPLAB IDE compiling error

Postby TeoYX » Thu Dec 29, 2011 12:17 am

Hi All,


Thanks a lot for all your reply. So sorry i am away for a short period. Yes, i tried to combine some functions together and remove some redundant codes then the over-code error is solved. Then i included the .h file into the header file, as attached photo. However, the error still come out when debugging.

PIC Debug Problem.jpg




Is there something wrong to do so? Please advise. Thanks.
TeoYX
Apprentice
 
Posts: 47
Joined: Fri Aug 12, 2011 10:47 pm

Re: MPLAB IDE compiling error

Postby robosang » Thu Dec 29, 2011 8:56 pm

Yup, ober is right, the printscreen did show most of the thing :)

It seem you din include the c files under the "Source Files" folder under the project. You need to do that.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: MPLAB IDE compiling error

Postby TeoYX » Fri Dec 30, 2011 1:03 am

OK, i realized that i should include the i2c.h and i2c_rtc.h after add the .c file inside the source files.

PIC Build Success.jpg



Thanks a lot for all your help. Really appreciate this!!!
Attachments
PIC Debug Problem 2.jpg
TeoYX
Apprentice
 
Posts: 47
Joined: Fri Aug 12, 2011 10:47 pm

Re: MPLAB IDE compiling error

Postby robosang » Tue Jan 03, 2012 7:13 am

Superb! So where is your project ?? Show us the hardware and how it work 8-)
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Previous

Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 0 guests

cron