EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / 8051.h error in Keil, simple C blink-LED code

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

|

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

  • This topic has 2 replies, 3 voices, and was last updated 11 years, 5 months ago by Ashutosh Bhatt.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • December 17, 2014 at 10:23 pm #3355
    Ashton C.
    Participant

    This may be a rediculously simple/obvious problem, but I have tried everything.
     

    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, when I try to build a new hex file from the C code, there is an error with the 8051.h library. I have placed the 8051.h file in the same folder as is holding the LED.c file, and where the hex file is stored.

    Error text:

    compiling LED.c…
    8051.h(29): error C129: missing ‘;’ before ‘__at’
    Target not created
     

    Here is the original blink LED code:

    <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--);
    }

    </code>

     

    Do I have bad 8051.h files I’m testing, or what fix may be necessary to correct this? I have tried multiple 8051.h files and an STC_8051.h with the same problem.  The examples were created in Keil uVision 3, I’m using 4 if that matters.

     

    Any guidance appreciated.

    December 18, 2014 at 4:22 am #12429
    AJISH ALFRED
    Participant

    Hi,

    Are you sure you have the “8051.h” header file in the same folder where your main code is kept? 

     

    December 21, 2014 at 6:32 pm #12443
    Ashutosh Bhatt
    Participant

    in keil just include reg51.h

     

    why to include 8051.h externally?

     

    just write

    #include <reg51.h>

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Replacement IGBT for DGG4015 for Honda Motorcycle ECU June 14, 2026
  • Mitsubishi Electric IPM module lot code format - how to decode? June 14, 2026
  • TDK Lambda ESS 500-20-11-D-LB-RSTL Parallel Operation June 13, 2026
  • Programmable 1kV DC Power Supply – Budget ~$600 with Display June 13, 2026
  • effect of calibration on s-parameters June 13, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise