Solved

embedded c

Posted on 2010-08-16
6
584 Views
Last Modified: 2012-06-27
Hi,

I am working on I2C interface with PIC32. I have taken code from microchip website. I have copied that 2 folders of I2C. but in project file they have included HardwareProfile.h and in source file i2c_master.c. But if I create a new project and include new .c and HardwareProfile.h file. It is giving an error that HardwareProfile.h file or directory not found.
0
Comment
Question by:skadulkar
  • 3
  • 3
6 Comments
 
LVL 9

Expert Comment

by:masheik
ID: 33443897
Hi skadulkar,

In your include , just try adding full .h file path like #include"C:\\C_EmbeddedProjects\ECProjc\\HardwareProfile.h"

or set the library directory that contains the required .h file into include directories option from your IDE .
0
 

Author Comment

by:skadulkar
ID: 33444096
Hi,

I tried your solution. Now it not giving me an error of hardwarProfile.h file or directory not found but it is giving me an error that `SYS_CLOCK' undeclared. even though it is declared in the hardwareprofile.h file


Here is the file

// Clock Constants
#ifndef SYS_CLOCK
      #error "Define SYS_CLOCK (ex. -DSYS_CLOCK=80000000) on compiler command line"
#endif
#define GetSystemClock()            (SYS_CLOCK)
#define GetPeripheralClock()        (SYS_CLOCK/2)
#define GetInstructionClock()       (SYS_CLOCK)
#define I2C_CLOCK_FREQ              5000

// EEPROM Constants
#define EEPROM_I2C_BUS              I2C1
#define EEPROM_ADDRESS              0x50        // 0b1010000 Serial EEPROM address



regards,
shailendra.
0
 
LVL 9

Expert Comment

by:masheik
ID: 33444113
As in your code, SYS_CLOCK should be a #define constant ,

try to put
#define SYS_CLOCK 80000000 at very beginning of HardareProfile.h and compile,

and also look at this code,

#ifndef SYS_CLOCK
      #error "Define SYS_CLOCK (ex. -DSYS_CLOCK=80000000) on compiler command line"
#endif
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

Author Comment

by:skadulkar
ID: 33446706
Hi masheik,

I tried it, but still it is giving the same error.
And as it is not declared in original code also,how it gets compiled and not mine. because i just copy pasted the code.

shailendra.
0
 

Author Comment

by:skadulkar
ID: 33451468
Hi,

I tried it, but still it is giving the same error.
And as it is not declared in original code also,how it gets compiled and not mine. because i just copy pasted the code.

shailendra.
0
 
LVL 9

Accepted Solution

by:
masheik earned 500 total points
ID: 33455416
Hi shailendra,

      This error generally occurs if you miss some libraries ie inlcude files missed during compilation, please check all the required libraries have been included  from your ide you can do this ,
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
logging Access violation 6 18
SQL handling single and double quotes 3 94
Concatenate two strings Last and First Name 10 59
How to creat good software interface ? 1 60
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now