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.
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?
I'll venture a guess: that 8051.h is made for (or was even taken from) another compiler. You didn't seriously expect it would just work out of the box on Keil C51, did you?
You are right, the
led = led
doesn't make sense to me. This is the entire code.
I may have found my problem with the Build.
I found another example entirely, that does Build in Keil.
The item groups of the project that does build include xxxx.h and corresponding xxxx.c files. This is my problem I believe.
The 8051.h was in a Keil 3 project file, included with a Chinese STC development board.
Using the pre-compiled hex files for each test, they load & execute properly. But I wanted to back up to edit, re-compile, and reload.
So have you contacted the supplier about it?
8051.h(29): error C129: missing ';' before '__at'
Have you actually looked at line 29 in 8051.h?
__at is not a valid Keil thing - so it does look very much like you've been given a dud file!
http://www.keil.com/support/man/docs/c51/c51_le_absvarloc.htm
"there is an error with the 8051.h library"
8051.h is a Header file - it is not a library.
Hi,
I am new to the 'embedded C' world. Can anyone please give me entire program or a link for blinking LED program in C language for ARM Cortex M0,ARM Cortex P and ARM Cortex 3.
I am using µvision v16a IDE. Please let me know if i need to provide any other information.
Thanks in advance :)