We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
HI: We can use exit(0) instruction to exit a normally running routine in C language. But exit(0) is not being in the KEILC51.Now how can I realize the same function as exit(0) instruction with other instructions?
.
"We can NOT use exit(0) instruction to exit a normally running routine in EMBEDDED C"
Yes we can. We just have to define ourselves what should happen. It's just that the most likely decisions would lead to a similar function but with a very different name - something like: halt() shutdown() reboot() reset() restart() power_off() power_cycle() lock_up_until_manual_reset() return_to_bootloader()
If we do have a boot loader, then a running program _can_ exit() to another program that will pick up the execution. But since it isn't as obvious in an embedded device that there are anything that may possibly pick up the pieces after an exit, and since a boot loader may not be implemented so that it is entough to just run past the last closing brace of main(), any jump to a boot loader will normally have to be very explicit, giving a reason for a more explicit name than just the generic exit().
So the concept of an exit() can be had. But a generic implementation can't exist without a minimalistic OS or application laucher, and without an application launcher the meaning/result of such a call is not obvious. Hence, the name exit() should not exist in any device that does not have a generic application launcher.
Of course you can; as I explained previously.
Use of the function name exit may be misleading, but it can be done.
Wherever you would like it to exit to.
"What's in a name? That which we call a rose ..."