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

Parents
  • 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.

Reply
  • 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.

Children
No data