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

first project on uvision2 not working.

I have created my first project and I have included only one file, which is very simple, and here is the contents of it.

 /*This program demonstrates the use TCON and TMOD SFR. */

#include <REG51F.H>
#include <stdio.h>

void wait (void)  {                   /* wait function */
  ;                                   /* only to delay for LED flashes */
}

void main (void)  {
   unsigned int delay_counter;

   /*Set 0th bit of TMOD register to indicate that the timer0 is running
   in 16-bit mode.*/
   TMOD = 0x01;

   /*Set 4th bit of TCON register to indicate timer0 to be running*/
   TCON = 0x0F;

   for(delay_counter = 100000; delay_counter<0;delay_counter--)
   {
      wait();
   }

   printf("THO is:%u, TLO is:%u\n");

   /*Check for overflow by checking whether 5th bit of TCON register is set.*/

   if (TF0 == 1)
   {
      printf("Timer overflowed\n");
   }

}


The error I am getting is

"Cannot open the file REG51F.H"

Please help as I am new to this tool.

Thanks
Ashwath

  • "I have created my first project ... I am new to this tool."

    Did you read the "Getting Started with µVision2 and the C51 Microcontroller Development Tools" manual?
    Did you work through the example projects in it?

    If not, I suggest that you should do that first - then come back to your own project when you're no longer entirely new to the tools!

  • The error means that the compiler cannot find the header file in any of the places it looks for header files. So, I'd guess that something is unusual about your installation. The default installation checks the standard header directories (c:\keil\c51\inc\...) without needing to be told. Perhaps you have them somewhere else?

    If nothing else, you should be able to add the location of your header file with the appropriate directive and get it to work.

  • The crucial question to ask yourself would be: where did you gather the idea that #include <reg51f.h> should work, in the first place?

    Given the fact that it quite obviously doesn't, that points the blame at the source of that information, until you find a better explanation.