Solved

embedded c

Posted on 2010-08-16
6
583 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them 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.

707 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

18 Experts available now in Live!

Get 1:1 Help Now