EMBEDDED
EMBEDDED
C Language Embedded C
Embedded C is used for embedded systems
C is mainly used for developing desktop
that have limited resources like ROM, RAM
applications
and more
It is of native development nature It is used for cross-development purposes
• A function is called reentrant if the function can be interrupted in the middle of the
execution and be safely called again (re-entered) to complete the execution.
• The interruption can be in the form of external events or signals or internal signals
like call or jump.
• The reentrant function resumes at the point where the execution was left off and
proceeds to completion.
• It is possible to replace dozens or even more of hardware logic gates, input buffers,
timing circuits, output drivers, etc. with a relatively cheap microprocessor.
Microprocessor Microcontroller
Microprocessor is managers of the resources
Microcontroller have I/O, memory, etc. built
(I/O, memory) which lie outside of its
into it and specifically designed for control
architecture
• Real-time embedded systems are computer systems that monitor, respond or control
an external environment.
• This environment is connected to the computer system through actuators, sensors, and
other input-output interfaces.
13. What kind of loop is better - Count up from zero or Count Down to zero?
• Loops that involve count down to zero are better than count-up loops. This is because
the compiler can optimize the comparison to zero at the time of loop termination.
• The processors need not have to load both the loop variable and the maximum value
for comparison due to the optimization. Hence, count down to 0 loops are always
better
14. List out some of the commonly found errors in Embedded Systems?
Semaphores Mutexes
A semaphore can be signaled from any other Mutex can only be released by thread which
thread or process. had acquired it
While for semaphore you won’t know which
Mutex will always have a known owner
thread we are blocking on
17. Explain what is the need for an infinite loop in embedded systems?
• Embedded systems require infinite loops for repeatedly processing or monitoring the
state of the program.
• For instance, the case of a program state continuously being verified for any
exceptional errors that might just happen during run-time such as memory outage or
divide by zero, etc.
19. What are the differences between the const and volatile qualifiers in embedded C?
Const Volatile
The keyword const is enforced by the The keyword volatile tells the compiler to not
compiler and tells it that no changes can be perform any optimization on the variables and
made to the value of that object/variable not to assume anything about the variables
during program execution against which it is declared.
• The Volatile keyword is mainly used for preventing a compiler from optimizing a
variable that might change its behavior unexpectedly post the optimization.
• To inform the compiler, we use the keyword volatile at the time of variable
declaration.
• Interrupt latency is a time taken to return from the interrupt service routine post
handling a specific interrupt.
• Cell phones
• TV
• Medications
• Passenger vehicles
• The Dishwasher
27. What is the maximum oscillator frequency and peak performance of the 8051?
• An 8051’s oscillator frequency could reach 12 MHz and its peak performance was 1
MIPS.