[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

embedded c

Posted on 2010-08-16
6
Medium Priority
?
606 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

829 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