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

8051.h error in Keil, simple C blink-LED code test

I'm trying to set up and test an 8051 development board. I'm using Keil uVision 4, with some code examples included with the dev board. The included hex file examples upload to the 8051 and work perfectly.

My problem is in Keil (4.72.9.0), when I try to build a new hex file from a uVision project file, there is an error with the 8051.h library. The 8051.h file is listed as a Source Group 1 item.

Error text:
compiling LED.c...
8051.h(29): error C129: missing ';' before '__at'
Target not created

Here is my code:

/**********
Blink LED
***********/
#include "8051.h"
sbit led=P2^0;
void delay(unsigned int time);
void main(void)
{
        while(1)
        {
                led = led;
        delay(40000);
                delay(20000);
                delay(20000);
                delay(20000);
        /*
            led=1;
                delay(20000);
                led=0;
                delay(20000);
                */
        }
}
void delay(unsigned int time)
{
        while(time--);
}

Do I have bad 8051.h files, or what fix may be necessary to correct this? I have tried multiple 8051.h files.

Any guidance appreciated.

Parents
  • Are there any more source lines in LED.c that you aren't showing?

    Line 29 in 8051.h is quite early - possibly the first non-comment part of the header file. And the error might be the result of an error in the LED.c file from before the include of the header file.

    By the way - why have a test program where you do the following?

        led = led;
    


    What result would you expect from the above code line?

Reply
  • Are there any more source lines in LED.c that you aren't showing?

    Line 29 in 8051.h is quite early - possibly the first non-comment part of the header file. And the error might be the result of an error in the LED.c file from before the include of the header file.

    By the way - why have a test program where you do the following?

        led = led;
    


    What result would you expect from the above code line?

Children