Iteanz Interview Questions | Latest Technologies Interview Questions

EMBEDDED SYSTEMS INTERVIEW QUESTIONS AND ANSWERS

Written by Rupa.R | Sep 10, 2022 9:26:25 AM

Q1). Explain what is embedded system in a computer system?
Ans: An embedded system is a computer system that is part of a larger system or machine.  It is a system with a dedicated function within a larger electrical or mechanical system.

Q2). Mention what are the essential components of embedded system?
Ans: Essential components of embedded system includes
Hardware

  • Processor
  • Memory
  • Timers
  • I/O circuits
  • System application specific circuits

Software

  • It ensures the availability of System Memory
  • It checks the Processor Speed availability
  • The need to limit power lost when running the system continuously

Real Time Operating System

  • It runs a process as per scheduling and do the switching from one process to another

Q3). Mention how I/O devices are classified for embedded system?
Ans: The I/O devices of embedded system are classified into two categories

  • Serial
  • Parallel
Serial Input Output
·          Synchronous : Audio/Video signal Audio/Video signal
·          Asynchronous : Keypad, Mouse, Modem Printer, Modem
     
Parallel Input Output
·          Single bit : Rotation, Threshold sensors Pulses to external circuit
·          Multi bit : Vp from ADC, sensors LCD, Printer

 

Q4). Why embedded system is useful?
Ans: With embedded system, 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.

Q5). Explain what are real-time embedded systems?
Ans: 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.

Q6). Explain what is microcontroller?
Ans: The microcontroller is a self-contained system with peripherals, memory and a processor that can be used as embedded system.

Q7). Mention what is the difference between microprocessor and microcontroller?
Ans: Microprocessor is managers of the resources (I/O, memory) which lie outside of its architecture
Microcontroller have I/O, memory, etc. built into it and specifically designed for control

Q8).What does DMA address will deal with?
Ans: DMA address deals with physical addresses. It is a device which directly drives the data and address bus during data transfer. So, it is purely physical address.

Q9). Explain what is interrupt latency? How can you reduce it?
Ans: Interrupt latency is a time taken to return from the interrupt service routine post handling a specific interrupt.  By writing minor ISR routines, interrupt latency can be reduced.

Q10). Mention what are buses used for communication in embedded system?
Ans: For embedded system, the buses used for communication includes

  • I2C: It is used for communication between multiple ICs
  • CAN: It is used in automobiles with centrally controlled network
  • USB: It is used for communication between CPU and devices like mouse, etc.

While ISA, EISA, PCI are standard buses for parallel communication used in PCs, computer network devices, etc.

Q11). List out various uses of timers in embedded system?
Ans: Timers in embedded system are used in multiple ways

  • Real Time Clock (RTC) for the system
  • Initiating an event after a preset time delay
  • Initiating an even after a comparison of preset times
  • Capturing the count value in timer on an event
  • Between two events finding the time interval
  • Time slicing for various tasks
  • Time division multiplexing
  • Scheduling of various tasks in RTOS

Q12). Explain what is a Watchdog Timer?
Ans: A watchdog timer is an electronic device or electronic card that execute specific operation after certain time period if something goes wrong with an electronic system.

Q13). Explain what is the need for an infinite loop in embedded systems?
Ans: 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.

Q14). List out some of the commonly found errors in Embedded Systems?
Ans: Some of the commonly found errors in embedded systems are

  • Damage of memory devices static discharges and transient current
  • Address line malfunctioning due to a short in circuit
  • Data lines malfunctioning
  • Due to garbage or errors some memory locations being inaccessible in storage
  • Inappropriate insertion of memory devices into the memory slots
  • Wrong control signals

Q15). Explain what is semaphore?
Ans: A semaphore is an abstract datatype or variable that is used for controlling access, by multiple processes to a common resource in a concurrent system such as multiprogramming operating system.  Semaphores are commonly used for two purposes

  • To share a common memory space
  • To share access to files

Q16). Explain what is the difference between mutexes and semaphores?
Ans:

Mutexes Semaphores
·          A mutex object enables one thread into a controlled section, forcing other threads which tries to gain access to that section to wait until the first thread has moved out from that section ·          Semaphore allows multiple access to shared resources
·          Mutex can only be released by thread which had acquired it ·          A semaphore can be signaled from any other thread or process.
·          Mutex will always have a known owner ·          While for semaphore you won’t know which thread we are blocking on
·          Mutex is also a tool that is used to provide deadlock-free mutual exclusion (either consumer or producer can have the key and proceed with their work) ·          Semaphore is a synchronization tool to overcome the critical section problem
·          Mutexes by definition are binary semaphores, so there are two states locked or unlocked ·          Semaphores are usually referred to counted locks

  Q17). When one must use recursion function? Mention what happens when recursion functions are declared inline?
Ans: Recursion function can be used when you are aware of the number of recursive calls is not excessive. Inline functions property says whenever it will called, it will copy the complete definition of that function. Recursive function declared as inline creates the burden on the compilers execution.

Q18). Explain whether we can use semaphore or mutex or spinlock in interrupt context in Linux Kernel?
Ans: Semaphore or Mutex cannot be used for interrupt context in Linux Kernel. While spinlocks can be used for locking in interrupt context.

Q19).What is lst file?
Ans:
– This file is also called as list file.
– It lists the opcodes ,addresses and errors detected by the assembler.
– List file is produced only when indicated by the user.
– It can be accessed by an editor and displayed on monitor screen or printed.
– Programmer uses this file to find the syntax errors and later fix them.

Q20).How is a program executed’ bit by bit’ or’ byte by byte’?
EXAMPLE:

ADDRESS OPCODE PROGRAM
1   0000   ORG 0H
2   0000 7D25 MOV R5,#25H
3   0002 7F34 MOV R7,#34H
4   0004 2D ADD A, R5
5   0005   END

Ans:
– A program is always executed byte by byte.
– Firstly,1st opcode 7D is fetched from location 0000 and then the value 25 is fetched from 0001 .
– 25 is then placed in the register R5 and program counter is incremented to point 0002.
– On execution of opcode 7F, value 34 is copied to register R7.
– Then addition of contents of R5 and accumulater takes place.
– Here all the opcodes are 8 bit forming a byte.

Q21).Explain DB.
Ans:
– DB is called as define byte used as a directive in the assembler.
– It is used to define the 8 bit data in binary ,hexadecimal or decimal formats.
– It is the only directive that can be used to define ASCII strings larger than two characters.
– DB is also used to allocate memory in byte sized chunks.
– The assembler always converts the numbers lnto hexadecimal.

Q22).What is EQU?
Ans:
– EQU is the equate assmbler directive used to define a constant without occupying a memory location.
– It associates a constant value with data label .
– Whenever the label appears in the program ,constant value is subsituted for label.
– Advantage: The constant value occuring at various positions in a program can be changed at once using this directive.
– Syntax: label EQU constant value

Q23).How are labels named in assembly language?
Ans:
– Label name should be unique and must contain alphabetic letters in both uppercase and lowercase.
– 1st letter should always be an alphabetic letter.
– It can also use digits and special characters ?,.,@,_,$.
– Label should not be one of the reserved words in assembly language.
– These labels make the program much easier to read and maintain.

Q24).Are all the bits of flag register used in 8051?
Ans:
– The flag register also called as the program status word uses only 6 bits.
– The two unused bits are user defineable flags.
– Carry, auxillary carry, parity and overflow flags are the conditional flags used in it.
– PSW.1 is a user definable bit and PSW.5 can be used as general purpose bit.
– Rest all flags indicate some or the other condition of an arithmetic operation.

Q25).Which bit of the flag register is set when output overflows to the sign bit?
Ans:
– The 2nd bit of the flag register is set when output flows to the sign bit.
– This flag is also called as the overflow flag.
– Here the output of the signed number operation is too large to be accomodated in 7 bits.
– For signed numbers the MSB is used to indicate the whether the number is positive or negative.
– It is only used to detect errors in signed number operations.Which register bank is used if we use the following instructions.
SETB PSW.3       A
SETB PSW.4       B

– Statement A sets 3rd bit of flag register.
– Statement B sets 4th bit of flag register.
– Therefore register bank 3 is initiated .
– It uses memory location 18H to 1FH.
– The register bank is also called as R3.

Q26).Issues related to stack and bank 1.
Ans:
– Bank 1 uses the same RAM space as the stack.
– Stack pointer is incremented or decremented according to the push or pop instruction.
– If the stack pointer is decremented it uses locations 7,6,5… which belongs to register bank 0.
– If a given program uses R1 then stack is provided new memory location.
– The push instruction may also take stack to location 0 i.e.it will run out of space.

Q27).Explain JNC.
Ans:
– It is a command used to jump if no carry occurs after an arithematic operation.
– It is called as jump if no carry( conditional jump instruction).
– Here the carry flag bit in PSW register is used to make decision.
– The processor looks at the carry flag to see if it is raised or not.
– If carry flag is 0 ,CPU fetches instructions from the address of the label.

Q28).Can port 0 be used as input output port?
Ans:
– Yes, port 0 can be used as input output port.
– Port 0 is an open drain unlike ports 2,3,4.
– To use it as input or output the 10k ohm pull-up resisters are connected to it externally.
– To make port 0 as input port it must be programmed by writing 1 to all bits.
Example:
MOV A,#0FFH
MOV P0,A

Which 2 ports combine to form the 16 bit address for external memory access?

– Port0 and port2 together form the 16 bit address for external memory.
– Port0 uses pins 32 to 39 of 8051 to give the lower address bits(AD0-AD7)
– Port2 uses pins 21 to 28 of 8051 to give the higher address bits(A8-A15)
– This 16 bit address is used to access external memory if attached.
– When connected to external memory they cannot be used as input output ports.

Q29).Can single bit of a port be accessed in 8051?
Ans:
– Yes, 8051 has the capability of accessing only single bit of a port.
– Here only single bit is accessed and rest are unaltered.
Syntax: “SETB X. Y”.
– Here X is the port number and y is the desired bit.
Example: SETB P1.2
Here the second bit of port 1 is set to 1.

Other than SETB ,CLR are there any single bit instructions?

– There are total 6 single-bit instructions.
– CPL bit : complement the bit (bit= NOT bit).
– JB bit,target: Jump to target if bit equal to 1.
– JNB bit,target: Jump to target if bit is equal to 0.
– JCB bit,target: Jump to target if bit is equal to 1 and then clear bit.