Hello, I use the C51 compilers to compile C programs to the 87C51 microcontroller. When i compile my file, te compiler makes the program as endless loop ( The program runs continuously ). How can compile the file without this loop? Thank you very much, Sagi.
If you want to execute the program once use a endless loop like
while(1);
for (;;); does not require the compiler to emit a diagnostic though.
and it compiles nicely to
?C0xxx: SJMP ?C0xxx
Kindly help me out on my project as it is very similar to yours. Kindly send how to go about connecting 87C51 to other components- A/D converter, LED, 4X4 keypad and the C language code you used please
C has a built-in expectation that main() is called from an OS -- Unix -- which supplies the argc and argv parameters, and cares about the return value from main(). However, embedded devices usually start running when the power is turned on and never stop. Exiting main is usually considered to be a programming error, and restarting the program from scratch is a reasonable thing to do for an embedded compiler in that case. It's this reset that makes it look like your program is looping. Hence the need for an infinite loop to "stop" the program at the end of main. Also, your 8051 derivative may support some sort of power-down mode. You could enter that mode to stop instead of looping.
"for (;;); does not require the compiler to emit a diagnostic though" Nor does while(1); Stefan
"and it compiles nicely to ?C0xxx: SJMP ?C0xxx" So does while(1); Stefan
Where can I start my project I want to simulate using 87C51 with 4X4 keypad, A/D etc
Pls email me on rezav71@aol.com
"Where can I start my project..." Start by reading the "Getting Started with uVision" Manual, and working through the example projects. And, if you have a specific question to ask, start your own Thread - don't hijack somebody else's Thread on an unrelated topic!