This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

#define "val.h"

hai,

I had written a code in following way

#include <REGX55.H>
#include <math.h>
#include "DEFINE_H.h"
void delay(unsigned int);

main()

{
while(1)
{ HEALTH = ~HEALTH;
delay(65535);
delay(65535);
} }

void delay(unsigned int count)
{ while(count) count--;
}

In DEFINE_H.h i had declared the HEALTH = p3_4 ;

BUT WHEN COMPILING THE PROJECT IT IS SAYING THAT HEALTH IS UNDEFINED IDENTIFIER. BUT I HAD DEFINED IN THE DEFINE_H HEADER FILE AND I HAD INCLUDED HEADER FILE IN A MAIN.C

  • You failed to notice the clearly-stated instructions that tell you how to post source code:

    www.danlhenry.com/.../keil_code.png

    People reading your post may overlook that error, and try to make sense of your post - but a Compiler will not.

    When the compiler says something is "undefined", it means, more precisely, that there is no valid definition; ie, what you wrote was not valid as a definition.

    Check your code very carfully to make sure that it is precisely correct and you have followed every rule in minute detail!

    Did the compiler also report any other errors?

  • BUT WHEN COMPILING THE PROJECT IT IS SAYING THAT HEALTH IS UNDEFINED IDENTIFIER. BUT I HAD DEFINED IN THE DEFINE_H HEADER FILE AND I HAD INCLUDED HEADER FILE IN A MAIN.C

    In that case you probably didn't define HEALTH. You say you did. Who do we believe - you or the compiler?

    You need to show the line of code where you think you define HEALTH. That means the actual line of code, not a mistyped version of it.

    You will (ok, probably will) get useful help from this forum but only if you take the time to read the instructions on how to post, think carefully about what you need to post and turn off your caps lock.

  • Review your manuals for defining port pins.
    HEALTH = p3_4 ;?
    Is this line valid?
    Bradford