Link to home
Start Free TrialLog in
Avatar of skadulkar
skadulkarFlag for India

asked on

embedded c

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.
Avatar of masheik
masheik
Flag of India image

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 .
Avatar of skadulkar

ASKER

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.
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
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.
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.
ASKER CERTIFIED SOLUTION
Avatar of masheik
masheik
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial