(Question Bank)


Embedded Systems- QB

B.E. (Electronics and Communication Engg) Regulation 2007 SEMESTER –VII


3 1 0 100

UNIT I ARCHITECTURE OF EMBEDDED SYSTEMS 9 Categories of Embedded Systems-Specifications of Embedded systems-Resent trends in Embedded Systems-Hardware Architecture-Software ArchitectureCommunication software-Process of generation of executable imagedevelopment/testing tools. UNIT II PROGRAMMING FOR EMBEDDED SYSTEMS 9 Getting the most of C-data types-manipulating bits in memory and I/O portsaccessing memory mapped I/O devices – structures-variant access-mixing C to assembly-register usage-use of addressing options-instruction sequencing – procedure call and return-parameter passing –retrieving parameters memory management-scope-automatic allocation-static allocation-dynamic allocationshared memory recognizing shared objects-reentrant functions-accessing shared memory device drivers- productivity tools. UNIT III HARDWARE PLATFORM 9 PIC microcontroller- Architecture of PIC 16c6x/7x- FSR- Reset actionOscillatory connection- Memory organization- Instructions- Addressing modesI/O ports- Interrupts-Timers- ADC- Assembly language programming. UNIT IV REAL-TIME OPERATING SYSTEM CONCEPTS 9 Architecture of the Kernel-task and task scheduler-Interrupt Service RoutinesSemaphores-Mutex- Mailboxes-Message Queues-Event Registers-Pipes-SignalsTimers-Memory Management – Priority Inversion Problem UNIT V REAL-TIME OPERATING SYSTEM TOOLS AND CASE STUDIES 9 Use of µC/OS-II- Case study of coding for an Automatic Chocolate Vending Machine using MUCOS RTOS- Case study of an Embedded system for an Adaptive Cruise Control Systems in a Car- Case study of an Embedded Systems for a Smart Card.

REFERENCES: 1. K.V.K.K.Prasad “Embedded /Real-Time Systems: Concepts, Design and Programming” Dream tech, Wiley 2003. 2. Ajay V Deshmukh “Microcontroller Theory and Applications” TMH 2005. 3. Raj Kamal “Embedded Systems Architecture Programming and Design” 2nd Edition TMH, 2008. 4. David E Simon “An Embedded Software Primer” Pearson Education 2003. 5. Daniel W. Lewis, “Fundamentals of Embedded Software” Pearson Education2001. 6. Peatman “Designing with PIC Micro Controller”, Pearson 2003.


© NSS, VVCET. 2010

Embedded Systems- QB

1. Define Embedded Systems. An embedded system is one that has computer hardware with software embedded on it as one of its most important component. An embedded system is a computing device that does a specific and repetitive job. 2. Write some applications of Embedded Systems. Smart card Missiles & Satellites Computer Networking Automotives 3. What are the classifications of Embedded system? Small scale Embedded System Medium scale Embedded System Sophisticated Embedded System. 4. Give examples for Small, Medium & sophisticated scale embedded systems. Small Scale Embedded System Automatic chocolate vending machine Stepper motor controller for a robotics system Washing or cooking system Multitasking toys Medium Scale Embedded System Computer Networking Systems Entertainment systems Embedded firewall / Router Signal tracking system Sophisticated Scale Embedded System Embedded system s for wireless LAN & for convergent technology devices. Security products & high speed network security, gigabit rate encryption rate products Embedded system for real time video & speech 5. List the categories of embedded system. Stand-alone embedded systems. Eg. AC, Oven, CD player, TV. Real-time systems. Eg. Aircraft control, Missile & Satellite control Networked Information appliances. Eg. Weather monitoring system Mobile Devices. Eg. PDAs, Smart phones.


© NSS, VVCET. 2010

Embedded Systems- QB 6. List the specialties of embedded systems. Reliability Performance Power Consumption Cost Size Limited User interface Software upgradation capability List the factors to be considered while evaluating the processor for embedded system. Clock Speed Length of Registers Number of Registers Width of Data and Address bus Internal RAM & ROM Interrupt lines No. of programmable I/O lines On-chip peripherals such as Timers, UART, ADC, DAC, etc. 8. What are the hardware components of embedded systems? Input devices, Interfacing/Driver circuits, Processor Timers Interrupt Controller Memory Serial/Parallel Ports Output Interfacing/Driver circuits Power supply, Reset & Oscillator circuits.


9. Define processor. A processor is a Chip, which implements a process or processes as per the command given to it.


© NSS, VVCET. 2010

Embedded Systems- QB 10. Define Embedded system processor. An embedded system processor has two essential units: Program Flow Control Unit and Execution Unit. The control unit includes a fetch unit for fetching instructions from the memory. Execution unit has circuits that implement the instructions. 11. Compare CISC and RISC processor. CISC: Complex Instruction Set Computer (CISC) Aim of designing CISC processor is to reduce the software complexity by increasing the complexity of the processor architecture. CISC has large no of instructions. Instructions required to do a job is less and hence, the memory requirement in less. No. of registers are available in CISC processor is very less. Eg. Intel x86 family and Motorola 68000 series processors. RISC: Reduced Instruction Set Computer (RISC) RISC has limited no. of instructions and hence, complex operation is carried out through sequence of more simple instructions. Large number of registers is required in RISC processor. Another important feature of RISC processor is pipelined instruction execution. Embedded systems generally use RISC processor. Eg. ARM, ATMEL, AVR, MIPS, Microchip’s PIC family processors, Power PC and Sun SPARC processor. 12. What are the three processor architectures in embedded systems? Von-Neuman Architecture: This architecture has common memory for both data and program codes.

Harvard Architecture: This architecture has separate memory for data and program codes.


© NSS, VVCET. 2010

Embedded Systems- QB Super Harvard Architecture: This architecture has slight modification from Harvard with instruction cache and separate program memory for program codes and secondary data.


What is microcontroller? A microcontroller is a unit with a processor. It is a single chip VLSI unit which, thought having limited computational capabilities, possesses enhanced input-output capabilities and a number of on-chip functional units.

14. What are the functional circuits of a microcontroller? The functional circuits of a microcontroller are, Processor Data & stack in internal RAM Timers & Watchdog timer ROM / PROM / EPROM External Memories Interfaces Interrupt Controller I/O Ports Control & Interfaces / Drivers Serial UART communication port 15. What are the features of DSP? A DSP provides fast, discrete-time, signal processing instructions. It has very large instruction word (VLIW) processing capabilities, it processes Single Instruction Multiple Data (SIMD) instructions fast, and it processes Discrete Cosine Transformations (DCTs) and inverse DCTs (IDTs) fast. 16. What is GPP & ASIP? GPP: A processor from a number of families of processors, microcontroller, embedded processors and DSPs having a general purpose instruction set and readily available compilers to enable programming in a high level language is called a General Purpose Processor (GPP). ASIP: A processor designed for specific application on a VLSI chip is called an Application Specific Instruction Processor. 17. What is ASSP? Application Specific System Processor is a processing unit for specific tasks, foe e.g. Image compression and that is integrated through the buses with the main processor in an embedded system.


© NSS, VVCET. 2010

Embedded Systems- QB 18. What is System-On-Chip? A system on a VLSI chip that has all of needed analog as well as digital circuits. For example, mobile phone. 19. What are the various forms of system memories? Internal RAM Internal ROM / PROM /EPROM External RAM Internal & External Caches External ROM / PROM RAM Memory buffers Hybrid memory such as E2PROM, NV-RAM or flash memory 20. List the important sensors and transducers. Temperature Sensors. Eg. AD22100, AD22103, DS18B20 Light Sensors. Eg. TAOS TSL250R Accelerometers. Eg. ADXL 150/250 Pressure Sensors. Eg. MPXA 6115A Microphone and Speakers Video camera and Monitor 21. List the important types of Displays. Light Emitting Diode (LED) Liquid Crystal Display (LCD) Thin Film Transistor (TFT) Display Organic Light Emitting Diode (OLED) 22. List the important Serial communication protocols. Inter-integrated Circuit (I2C) Serial Peripheral Interface (SPI) Universal Serial Bus (USB) Controller Area Network (CAN) 23. List the important communication interfaces used in embedded systems. Serial interface using RS232 Serial interface using RS422/RS485 Universal Serial Bus (USB) Infrared Ethernet Wireless interface using IEEE 802.11 (WLAN) Bluetooth ZigBee IEEE 802.15.4 24. Define interrupt handler. It is a unit that handles the processor operations arising out of an interrupt from a source.


© NSS, VVCET. 2010

Embedded Systems- QB 25. What is watchdog timer? It is a timer that timeout from which resets the processor in case the program gets struck for an unexpected time. 26. What is reset circuit and power-up reset? The reset circuit activates for a fixed period and then deactivates. It helps the processor to start the processing of instructions from a starting address. Power-up reset vector also provides a starting address which is different from that provided by a reset circuit.

27. List the different categories of OS. Single-tasking OS (MS-DOS) Multi-tasking OS (WINSOWS XP) Single-user OS (MS-DOS) Multi-user OS (UNIX) Command-driven OS (MS-DOS) GUI-based OS (WINDOWS XP) 28. List the functions of OS. Task management Memory management I/O management Providing service to applications Providing proper user interface that hides underlying hardware 29. What is Kernel? Kernel is a program with functions for memory allocation and deallocation, task scheduling, inter process communication, effective management of shared memory access by using the signals, exception handling signals, Semaphores, queues, mailboxes etc. 30. Define RTOS. Real Time Operating System is software for real-time programming and scheduling, process and memory manager device drivers, device management and multitasking. 31. List the special requirements in RTOS for embedded systems. Reliability Multi-tasking with time constraints Interrupt Latency control Small footprint Support diskless systems Portability Scalability Support for standard API


© NSS, VVCET. 2010

Embedded Systems- QB 32. What are the steps required for converting assembly language into a ROM image? Assembler Linker Loader Locator & Device Programmer

33. What is ROM image? The final stage software is also called ROM image, because just as an image is a unique sequence and arrangement of pixels, embedded software is also a unique placement and arrangement of bytes for instructions and data. 34. What is the use of code optimizer? Code optimizer is used in the conversion of high level language into a ROM image for optimizing the code before linking. 35. What is Compiler? Compiler is a software tool that converts a high level program (written using programming languages like C, C++, Java, and so on) into an object code. 36. What is Assembler? Assembler is a software tool that converts an assembly program (written using mnemonics of a processor, i.e., instruction set of a specific processor) into an object code.


© NSS, VVCET. 2010

Embedded Systems- QB 37. What are the steps required for converting high level language into a ROM image? Compiler Linker Loader Locator & Device Programmer

38. What is meant by context switching? The mechanism of storing the current status of CPU registers in a stack to run other task is known as context switching.

39. What is meant by Inter-task communication? Tasks may need to exchange data among themselves to synchronize the tasks in an application. This is known as Inter-task communication. The techniques used for ITC are Signals, Semaphores, Mailboxes, Queues, Pipes and Event flags.

39. What is meant by cross platform development? The process of developing machine codes for a specific processor of an embedded system from a high level / assembly level program written on a PC (with different processor) using various software tools is called cross platform development.


© NSS, VVCET. 2010

Embedded Systems- QB 40. List the various hardware development / testing tools. Digital Multimeter : Logic Analyzer : Oscilloscope : Spectrum Analyzer : Measures current, voltage, continuity of connections Checks the timing of the signals Analyze the waveforms in time domain Analyze the waveforms in frequency domain

40. List the various software development / testing tools. OS Development Suite Cross-platform Development tools (IDE) ROM Emulator EPROM Programmer Instruction Set Simulator (ISS) In-Circuit Emulator (ICE)

42. List the possible boot sequences of an embedded system. Execute from ROM using RAM for data Execute from RAM after loading the image from RAM Execute from RAM after downloading from the host


What is meant by Debug port? Debugging a processor based board is very difficult. Hence, manufacturers provide a standardized interface for debugging. JTAG (Joint Test Access Group) port is a mechanism provided to debug the embedded system hardware and also for downloading the software onto the embedded system board.


© NSS, VVCET. 2010



What are advantages of writing embedded software in Assembly Language? It gives a precise control of the processor internal devices. The machine codes are compact. Device driver codes may need only a few assembly instructions What are advantages of writing embedded software in C Language? The development cycle is short for complex systems. Type checking makes the program less prone to error. Control Structures make the program-flow path design tasks simple. Portability. What is embedded C++? Embedded C++ is a version of C++ that provides for a selective disabling which is the disadvantage in C++. So, there is a less run-time overhead and less run-time library. How can optimization be used to eliminate the disadvantages in embedded C++ programs? Optimization can be used as follows. Declare private as many classes as possible. Use of char, int and boolean in place of the objects as arguments Use local variables as much as feasible. Recover memory already used by changing the reference to an object to NULL. What is the use of type checking? Type checking makes the program less prone to error. For eg. It does not allow subtraction, multiplication and division on the ‘char’ data types. Define Configuration files. Configuration files are the files for the configuration of the system. Device configuration codes can be put in a file of basic variables and included when needed. What is difference between function and macro-function? A macro function is a collection of codes that is defined in a program by a name. It differs from a function in the sense that once a macro is defined by a name, the compiler puts the corresponding codes for it at every place where that macro name appears. But the codes for a function are compiled once only.








© NSS, VVCET. 2010

Embedded Systems- QB 8. What is recursive and reentrant function? Recursive Function: It is a function that calls itself. It must be a reentrant function also. Most often its use is avoided in embedded systems due to memory constraints. Reentrant Function: It is a function that is usable by the several tasks and routines at the same time. All its argument values are retrievable from the stack. What is the use of modifier register? When a modifier register is inside a function block, a CPU register is temporarily allocated when needed. There is no ROM or RAM allocation.


10. Define Queue. It is a data structure into which elements can be sequentially inserted and retrieved in a FIFO mode. It needs two pointers, one for the queue tail for insertion and other for the queue head for deletion. 11. Define Stack. A stack is a data structure in which elements can be pushed in or pulled out. It works on the principle of Last-In-First-Out (LIFO). 12. How interrupts are handled in Queue? Queuing of pointers to the function on interrupts and later on calling the functions from this queue is a better approach as it provides the use of short execution time interrupt-service routines. 13. Explain briefly stack overhead. The repeated call to recursive function may cause the stack to full. This leads to insufficient memory. Hence the stack overhead may occur which is primarily due to overflow of the stack. 14. What is meant by inline assembly? Inserting the assembly language codes in between the high-level language codes are called inline assembly. It gives the benefits of processor specific instructions and addressing modes. 15. What is Optimization of memory? When codes are made compact and fitted in small memory without affecting the code performance, it is called memory optimization. 16. Define scalar data types? The character, integer, unsigned integer, floating point number, long and double are called scalar data types. Unlike an array data consists of one single element. 17. Give some examples for reference data types. Arrays and strings are examples of reference data types.


© NSS, VVCET. 2010

Embedded Systems- QB 18. What is meant by platform independence? A code that can port on different machine and operating systems is said to be platform independent. 19. What are preprocessor directives? It is the program statements and directives for the compiler before the main function to define global variable, global macro, new data type and global constants. 20. What are the differences between including a header file and a text file or data file? The differences between including a header file and a text file or data file are, The header files are well tested and debugged modules. They provide access to standard libraries. The header file can include several text file or C files. A text file is description of the text that contains specific information. 21. List the Integer data types available in C programming language. Data type Char Short int Int Long int Char Short int Int Long int Size 8 bits 16 bits 16/32 bits 32 bits 8 bits 16 bits 16/32 bits 32 bits Range 0 to 255 0 to 65,535 same as unsigned short / long int 0 to 4,294,967,295 -128 to +127 -32768 to +32767 same as unsigned short / long int -2,147,483,648 to +2,147,483,647



22. Why TYPEDEFS are used in embedded system programming? C’s primitive data type “ char ” may default to either signed or unsigned, and its primitive data type “ int ” may have size of 16 or 32 bits. In most of the embedded applications, it’s imperative to know the number of bits and range of most variables. Hence, to avoid C’s ambiguity, derived data types are formed using TYPEDEFS and placed in a text file (Eg. typedefs.h) and included in every source code file that uses them. 23. What are the two types of data conversions? PROMOTION: A conversion is called a promotion, when there is no potential loss of accuracy as when assigning an integer value to a floating point variable. DEMOTION: It is the conversion which causes a loss of accuracy, when a floating point variable is assigned to an integer variable, or when a 32-bit integer value is assigned to a 8-bit char. Demotion usually make the compiler to issue a warning.


© NSS, VVCET. 2010

Embedded Systems- QB 24. List the Boolean and Bitwise operators. Operation AND OR XOR NOT Boolean Operator && || (Not supported) ! Bitwise Operator & | ^ ~

25. Find the result of the following expression? a) Boolean: (5 || !3) && 6 Ans:= (True OR (NOT True)) AND True = (True OR False) AND True = (True) AND True = True = 1 Ans:= (00000101 OR !(00000011)) AND 00000110 = (00000101 OR 11111100) AND 00000110 = (11111101) AND 00000110 = 00000100 = 4

b) Bitwise:

(5 | !3) & 6

26. List the bitwise operations performed on data bits. Testing bits Setting bits Clearing bits Inverting bits Extracting bits Inserting bits

27. What is the significance of Pointers in C programming? A Pointer in C is a variable that contains an address. This helps to access the data of a variable faster in memory. Eg. Int A, *B, C; A = 10 ; B = &A ; C = *B ;

28. What is an Array? An Array is an aggregate data type composed of several members of same data type. Eg. Int a[5]; A[0] A[1] A[2] A[3] A[4]


© NSS, VVCET. 2010

Embedded Systems- QB 28. What is a structure? A Structure is a aggregate data type composed of several distinct members. A single structure variable can contain member elements that represent a mix of chars, ints, doubles, etc. Structure declaration in C program struct PERSON { Int age; Char gender; }; struct PERSON sue; (or) PERSON sue;

Structure variable declaration

Initialization of structure variable members

sue.age = 25; sue.gender = ‘F’; (or) PERSON sue = {25, ‘F’};

29. What is meant by packed structures? Structures are always stored in memory with their member components in the same order as they appear in the structure description and there is no requirement that the components be contiguous. Struct {char c; Int I;} x; padding padding x.i padding x.c

Sometimes, we need to use structures to describe a layout in which all the data is contiguous. Thus, packed structures are a layout of data in memory in which the padding of zeros is disabled. Struct {char c; Int I; } x __attribute__ ((packed)); x.i x.c

30. What are Bit fields? Bit fields in structures allow us to access the data using cleaner syntax that hides all the necessary bit manipulation. Illustration of declaring structure bit fields Describing of time as structure in which the hours, minutes and seconds are declared as structure bit fields. typedef struct { seconds minutes hours } TIME time1; WORD16 : 6, : 5, : 5;


© NSS, VVCET. 2010

Embedded Systems- QB Time of 13:34:18 can be initialized into the packed representation time1 using simple reference operator as follows, time1.hours time1.minutes time1.seconds 31. What is a Union? Union is an aggregate data type in which the members of it share a common memory space. typedef union { unsigned long int real; FIXED32PARTS part; } FIXED32REAL result; 16 15 result.part.whole result.part.fract 0 = = = 13; 34; 18/2;


--------------------------- result.real ----------------------------

32. Explain the process of Assembler. The translation of assembly-language source code into binary object code is a two-step process in assembler. The assembler makes two complete passes over the source code of the program. During the first pass; the assembler builds a symbol table that contains the information about programmer–defined identifiers, such as the labels attached to instructions and the names of variables stored in memory. During the second pass; the assembler uses this information to construct the representation of the individual instructions.

33. List the instructions in C that transfers the program control to another part of memory. In C language, unconditional jumps are created by break, continue, switch and goto statements and at the end of loops.

34. Explain the importance of String instructions. There are some common loop operations that can be implemented using the Intel string instructions for ultimate speed. For example, string instructions can be used to initialize a region of memory to a constant value, scan a region of memory for a particular value, copy one region of memory to another, or compare the contents of two regions of memory.


© NSS, VVCET. 2010

Embedded Systems- QB 35. List the Intel conditional JUMP instructions. For comparing unsigned operands JA/JNBE JAE/JNB JBE/JNA JB/JNAE Jump if above / jump if not below or equal Jump if above or equal / jump if not below Jump if below or equal / jump if not above Jump if below / jump if not above or equal

For comparing signed operands JG/JNLE JGE/JNL JLE/JNG JL/JNGE Jump if Greater / jump if not less or equal Jump if Greater or equal / jump if not less Jump if less or equal / jump if not greater Jump if less / jump if not greater or equal

For equality comparisons JE/JZ JNE/JNZ Jump if equal / jump if zero (ZF=1) Jump if not equal / jump if not zero (ZF=0)

Other JUMP instructions JC JNC JS JNS Jump if CF=1 Jump if CF=0 Jump if SF=1 Jump if SF=0

36. List the attributes of Objects stored in memory. Type Name Value AddressScope Lifetimechar, int, unsigned int, etc. The identifier used to access the object The data held within the object The address in memory where the object resides That part of the source code where the object’s name is recognized The notion of when the object is created and destroyed, and thus, when it is available for use.

37. What is meant by scope in memory management? Scope of a variable is based on the place of declaration in the program. It is either declared (1) outside of all functions to create global variables or (2) immediately following a function header to create temporary variables local to the function.


© NSS, VVCET. 2010

Embedded Systems- QB 38. List the types of Memory allocation available in C. Method Object is created
Each time the program enters the function in which it is declared

Object is initialized
If specified in the declaration, initialization occurs each time the program enters the block Once: Just before the program starts to run

Object is destroyed


Each time the function returns


Once: When the program is first loaded into the memory

Once: When the program stops


By calling the library function malloc()

By writing executable statements that modify its content

By calling the library function free()

39. What is meant by shared memory? When two or more asynchronous (no predictable time relationship) instruction sequences access the same data, that data is called shared memory. Access to shared memory must be carefully coordinated or else data corruption may occur. 40. What is meant by shared functions? A shared function in one that is called by more than one thread; any function called by a shared function is also a shared function. Any static object referenced within a shared function is thus form of shared memory. Since there is only a single instance of the object, its content is inherently shared by all threads that call a function that references it. 41. Explain the type qualifier “const”. The keyword const is used to declare so that an object’s value may not be modified by the program, i.e., that its value is read only. The declaration of a const object must include an initial value, since no subsequent attempt to set its valued is allowed.

42. Explain the type qualifier “Volatile”. The keyword volatile may be attached as qualifier on the declaration of an object in C to indicate that its value may be asynchronously modified by mechanism other than the code in which the declaration appears, such as DMA or ISR.


© NSS, VVCET. 2010

Embedded Systems- QB UNIT II

Text book: Peatman, “Designing with PIC Micro Controller”, Pearson education, 2003.


List the features of PIC 16C6x/7x. PIC microcontroller is designed in Harvard Architecture Separate memory for program and data 13 bit address size for program memory 14 bit data bus for fetching codes from program memory 8 bit address size for data memory 8 bit data bus for accessing data in data memory 13-bit program counter Pipelined architecture for fast execution speed What is meant by instruction pipelining? Theory, pg. 28 and Fig.2-2, Pg. 29 Draw the Register file structure in PIC microcontroller. Theory, pg. 32, 33 and Fig.2-6, Pg. 33 List and brief the addressing modes in PIC microcontroller. Theory, pg. 33, 34 and Fig.2-7, 2-8 Pg. 34, 35 List the CPU registers of PIC microcontroller. Theory, pg. 35, 37 & 38 and Fig.2-9, Pg. 36 List the instruction set of PIC microcontroller. Theory, pg. 38, 40 and Fig.2-10, Pg. 39 Example programs for nine group of instructions. Programs, pg. 41, 42 Simple operations using instruction of PIC microcontroller. Programs, pg. 42, 43 List the external interrupts & timers of PIC microcontroller. The PIC microcontroller has one pin RB0/INT, which serves as its primary external interrupt input. In addition to above, it has three timers TIMER0 TIMER1 & TIMER2 with CCP module.









10. Explain how Port-B is initialized? Theory, pg. 109, 110 and Fig.6-1, Pg. 110 11. What is compare mode in timer of PIC microcontroller? Theory, pg. 117, and Fig.6-7, Pg. 118


© NSS, VVCET. 2010

Embedded Systems- QB 12. What is capture mode in timer of PIC microcontroller? Theory, pg. 119, 120, 121 and Fig.6-8, 6-9, Pg. 120, 121 13. Explain how TIMER1 of PIC microcontroller is used as external event counter? Theory, pg. 125 and Fig.6-12, Pg. 125 14. What is sleep mode in PIC microcontroller? Theory, pg. 126 15. Explain the PWM output of timer in PIC microcontroller. Theory, pg. 126, 127, 128 and Fig.6-14, Pg. 128 List the three applications of PWM outputs. Theory, pg. 126, 127, 128 and Fig.6-15, Pg. 129 Draw the circuit for control of PWM period. Theory, pg. 130 and Fig.6-19, Pg. 132 Explain the derivation of ten-bit counter used by PWM circuit. Theory, pg. 128, 129 and Fig.6-16, Pg. 130 Explain Serial Peripheral Interface (SPI). Theory, pg. 140, and Fig.7-1, Pg. 141





20. List the features of ADC in PIC 16C6x/7x microcontroller. Theory, pg. 195 21. Explain the code protection feature of PIC microcontroller. Theory, pg. 219 22. Explain the brown-out reset feature of PIC microcontroller. Theory, 7th paragraph in pg. 221 23. List the Oscillator configurations of PIC microcontroller. Theory, pg. 219, and Fig.12-2, Pg. 220 24. Explain the Reset alternatives of PIC microcontroller. Theory, pg. 219, 220, 221 25. Draw the two low-cost power supplies. Fig.12-3, Pg. 222 26. Explain the low power operation of PIC microcontroller. Theory, pg. 226 27. Explain the structure of Watchdog timer in PIC microcontroller. Theory, pg. 225, and Fig.12-7, 12-8, Pg. 225, 226, 227


© NSS, VVCET. 2010



Define RTOS. Operating System with real time task scheduling, interrupt-latency control, Synchronization of tasks with IPCs, predictable timing and synchronization behavior of the system. Name some RTOS services. (i) Basic OS functions (ii) RTOS Main functions (Task Scheduling & interrupt latency control) (iii) Time Management (iv) Predictability Compare OS and RTOS. OS: On a PC, OS takes control of the PC as soon as it is turned on and then it lets the application program to start. OS checks any pointer which passes into a system function for its validity. OS consumes lot of memory space and it contains all in-built functions. RTOS: Application program is linked to the RTOS. At boot-up, application usually gets control first and then it starts RTOS. Many RTOS don not protect themselves and skip the checking process for better performance. To save memory, RTOS has only the functions needed for an application.




What is Round Robin or cyclic scheduling? A scheduling algorithm in which the tasks are scheduled in sequence from a list of ready tasks. Explain briefly about Preemptive scheduling. A scheduling algorithm in which a higher priority task is forced (Preempted) to block the low priority task by the scheduler. What is Time Slicing and Fixed real time scheduling? Time Slicing Scheduling A scheduling algorithm in which each task is allotted a time slice after which it is blocked and waits for its turn on the next cycle. Fixed Real Time Scheduling A scheduling strategy in which the time for each task is fixed.




Explain briefly the term Task. Task is a subroutine in an application that makes certain action to be performed. A Task that has its independent program counter values and an independent stack. A single CPU system runs one task at a time. What is Task State? A state of a task changes on scheduler directions. A task at an instance can be in one of the four states, idle, ready, blocked ad running that are controlled by the scheduler.



© NSS, VVCET. 2010

Embedded Systems- QB 9. Explain Task scheduler. It is part of a RTOS. It keeps track of the state of each task and decides which one task should go into the running state. Scheduler in an RTOS looks at the priorities assigned to tasks, and among the tasks that not in the blocked state, the one with highest priority is allowed to run and the rest of them are made to wait in the ready state.

10. When a blocked task is allowed to run on a processor? When a task is blocked, it never gets the processor. Therefore, an interrupt routine or some another task in the system should signal that whatever the blocked task waiting for has happened. Otherwise, the task will be blocked forever. 11. How does a scheduler know whether a task is blocked or not? RTOS provides a collection of functions that tasks can tell a scheduler what events they wait for and to signal that events have happened. 12. What happens if all the tasks are blocked? If all the tasks are blocked, then the scheduler will spin in some tight loop somewhere inside the RTOS, waiting for something to happen. If nothing ever happens, then it ends in an infinite loop. Therefore care must be taken by programmer to invoke a interrupt routine that call some RTOS function that unblocks a task. 13. What if two tasks with the same priority are ready? There are two options in this situation. (1) RTOS should declare as illegal when two tasks are assigned with same priority. (2) RTOS can time-slice between two tasks that has the same priority. 14. List the rules to decide if a function is Re-entrant. 1. A reentrant function may not use variables in a non-atomic way unless they are stored on the stack of the task that call the function or are otherwise the private variables of that task. 2. A reentrant function may not call any other functions that are not themselves reentrant. 3. A reentrant function may not use the hardware in a non-atomic way. 15. Define Inter process communication (IPC). An output from one task (or process) passed to another task through the scheduler and use of signals, exceptions, semaphores, queues, mailboxes, pipes, sockets, and remote procedure call is known as inter process communication. 16. Define Semaphore. Semaphore is a special variable or function that is used to take note of certain actions to prevent another task or process from proceeding.


© NSS, VVCET. 2010

Embedded Systems- QB 17. List the semaphore related problems. Forgetting to take the semaphore Forgetting to release the semaphore Taking the wrong semaphore Holding a semaphore too long

18. Explain Mutex, Counting and Resource Semaphore. Mutex Semaphore A special variable used to take note of certain actions to prevent any task or process from proceeding further and at the same time let another task exclusively proceed further. Counting Semaphore Sometimes, a semaphore can be taken multiple times. A semaphore can be an integer which can be incremented when released and decremented when taken. If a task tries to take a semaphore when the integer value is equal to 0, then the task will be blocked. This is called Counting semaphore. Resource Semaphore Sometimes RTOS allows a semaphore to be released only by the task that has taken them. These semaphores are useful for shared data problem, but cannot be used for communication between two tasks. Such semaphores are called as Resource semaphores. 19. What are the problems that may arise while using semaphores? The problems that may while using semaphores are, Sharing of two semaphores creates a deadlock problem. Without a timeout an ISR worst-case latency may exceed the deadline. If a semaphore is not taken, and another task uses a shared variable. When using multiple semaphores, if an unintended task takes the semaphore, it creates a problem. It may introduce priority inversion problem. 20. What is shared data problem? If a variable is used in two different tasks and another task if interrupts without before the operation on that variable is completed, then the shared data problem arises. 21. List the ways to protect the shared data. Disabling the interrupts Taking semaphores Disabling the task switches


© NSS, VVCET. 2010

Embedded Systems- QB 22. Explain briefly Deadly embrace situation. Consider a situation in which two tasks (task1 and task2) are using two semaphores, semaphore_A and semaphore_B. When task1 is run, it takes semaphore_A and before it proceeds further and takes semaphore_B, RTOS switches to task2. Now task2 takes semaphore_B and it waits for release of semaphore_A by task1. None of these tasks are able to proceed further. This situation is called Deadly embrace. 23. What is priority inversion problem? How it can be solved? A problem in which a low priority task unintentionally do not release the semaphore for a higher priority task. This makes the high priority task to wait for low priority task to release the semaphore. This is called Priority Inversion. This problem can be solved by temporarily boosting the low priority task to higher priority task which is called as priority inheritance.

24. Explain the term (i) Message Queue (ii) Mailbox (iii) Pipe (iv) Socket. Message Queue RTOS allows a task to send multiple messages into a FIFO queue for use by another task(s) using queue message as an input. Mailbox RTOS allows a certain no. of messages to be stored in each mailbox. Separate functions are used to identify the appropriate mailbox, to add and read a message from the selected mailbox. Pipe Pipes are like queues. RTOS can create them, write to them, read from them and so on. Socket It provides the logical link using a protocol between the tasks in a clientserver or peer-to-peer environment.


© NSS, VVCET. 2010

Embedded Systems- QB 25. List the pitfalls in using Mailbox, Message queues and Pipes. Most of the RTOS do not restrict which tasks can read from or write to any given queue, mailbox or pipe. Therefore, programmer must ensure that tasks use the correct one each time. RTOS cannot ensure that data written onto a queue, mailbox or a pipe will be properly interpreted by the tasks that read it. Running out of space in queues, mailboxes or pipes is usually a disaster for embedded software. Passing pointers from one task to another through a queue, mailbox or pipe is one of the several ways to create shared data inadvertently.

26. What is Timer and counting devices? A Timer gets the inputs from the internal clock of a processor or from system clock and generates a required time delay. Counting device is a unit for getting the count-inputs on the occurrence of events that may be at irregular intervals. 27. What are the types of Timer? There are two types of timer. They are, Hardware timer Software timer 28. What is Timer Overflow or Time-Out? A state in which the number of count inputs exceeded the last acquirable value and on reaching that state, an interrupt can be generated. This state is called Time-Out or Timer Overflow. 29. What is the difference between hardware timer and software timer? Hardware timer gets the inputs from the internal clock with the processor or system clock. A device driver program programs it like any other physical device. Software timer executes a program which increases or decreases a count variable on an interrupt from a timer output or from a real-time clock interrupt. 30. What are the different states in a timer? The different states in a timer are, Reset State Idle State Present State Overflow State Active or Blocked State Done State


© NSS, VVCET. 2010

Embedded Systems- QB 31. Is it necessary to have a hardware timer device in a system? How does it work? Yes, it is necessary to have atleast one hardware timer device in a system. It is used as a system clock. The hardware timer gets the input from a clock out signal from the processor and activates the system clock as per the num ticks preset at the hardware timer.

32. What is an Event? An event is essentially a Boolean flag that tasks can set or reset and that other tasks can wait for. Event invokes a interrupt routine that runs a waiting task.

33. Compare Semaphores, Events and Queues/Mailbox/Pipe. Semaphores are usually the fastest and simplest methods. However, not much information can be passed through a semaphore, which passes just a 1-bit message saying that it has been released. Events are a little more complicated than semaphores and take little more of processor time. The advantage of events over semaphores is that a task can wait for any one of the several events at the same time and it can wait for only one semaphore. Queues (also mailboxes & pipes) allow sending a lot of information from one task to another. The drawback of queues (also mailboxes and pipes) is that adding and reading a message is more processor intensive and more prone to insert bugs while programming them. 34. How a block of data is passed using queue? Passing a pointer to a buffer from one task to another through a queue is a common way to pass a block of data.

35. Explain the problem in using malloc() and free() functions for memory management in RT embedded systems. In real time embedded systems, malloc() and free() are avoided because of their slow response and unpredictable execution times. Instead, most of the RTOS offer fast and predictable functions along with free fixed size buffers.

36. List the two rules that an interrupt routine must follow in RTOS environment, that do not apply to task codes. Rule-1: An interrupt routine must not call any RTOS function that might block the caller. Rule-2: An interrupt routine may not call any RTOS function that might cause the RTOS to switch tasks unless the RTOS knows that an interrupt routine, and not a task is executing.


© NSS, VVCET. 2010

Embedded Systems- QB


© NSS, VVCET. 2010



Name the important RTOS used in embedded systems. MUCOS, Vxworks, PSoS, RTX51, WinCE, RT Linux, Nucleus, Symbian are the important RTOS.


List the Main functions of RTOS. (i) Handling of interrupts. (ii) Task scheduling.


List the basic functions in an RTOS. The basic functions in an RTOS are, Kernel (Task Scheduler) Error handling functions System level functions System clock functions Time and delay functions Task state switch functions ISR functions Memory related functions IPC functions.


List the need for well tested & debugged RTOS. When designing a complex embedded system, one needs the thoroughly tested bug free codes for the following software components. Multiple task functions in Embedded C or C++ Real time clock based software timers employing system clock Software for cooperative scheduler to maintain time deadlines If cooperative scheduler is not suitable, then software for Pre-emptive scheduler Device drivers and device managers Functions for IPC Networking functions Error handling and Exception handling functions Testing and system debugging software A readily available, well tested and debugged RTOS thus not only simplifies the coding process greatly for a developer, but also helps in building a product fast; it aids in building robust and bug free software by thorough testing and simulation before locating the codes into the hardware.


© NSS, VVCET. 2010

Embedded Systems- QB 5. Explain C/OS-II (MUCOS) RTOS. is a freeware RTOS, developed by Jean J. Labrosse in 1992. is designed for non-commercial use. is well documented for developer’s reference. codes are written in C and in assembly language. code ports on any processor that are used for embedded



What are the files associated with


The source files of C/OS-II are categorized into two groups. a) Processor dependent source file: Two header files at the master are the following. os_cpu.h is the processor definitions header file os_cfg.h is the kernel building configuration file Two C files for ISR and RTOS timer are os_tick.c and os_cpu_c.c Assembly codes for task switching functions is os_cpu_a.s12 b) Processor independent source file: Two files, MUCOS header and C files are ucos.ii.h and ucos.ii.c. The C files for RTOS core, timer and task are os_core.c, os_time.c and os_task.c The memory partitioning, semaphore, queue and mailbox codes are os_mem.c, os_sem.c, os_q.c and os_mbox.c respectively.


List the features of


The features of MUCOS are as follows. MUCOS operating system functions has a prefix of OS or OS_. MUCOS is a scalable OS. For multitasking, MUCOS employs pre-emptive scheduler. MUCOS has system level functions. MUCOS has task service functions. MUCOS has task delay functions. MUCOS has memory allocation functions. MUCOS has Inter-Process Communication (IPC) functions. MUCOS has semaphore functions. MUCOS has mailbox functions. MUCOS has queue functions.


© NSS, VVCET. 2010

Embedded Systems- QB 8. List the System level functions in MUCOS. MUCOS support the following system level functions.
void OSInit (void) void OSStart (void) void OSTickInit (void) void OSIntEnter (void) void OSIntExit (void) OS_ENTER_CRITICAL OS_EXIT_CRITICAL At the beginning prior to OSStart() After OSInit() and task creating functions To initialize System timer ticks Just after the start of ISR codes before return form the ISR codes Macro to disable all interrupts Macro to enable all interrupts


List the Task service functions in MUCOS. MUCOS support the following task service functions to create, suspend and resume tasks, and to set and retrieve time.
unsigned byte OSTaskCreate (…) unsigned byte OSTaskSuspend (..) unsigned byte OSTaskResume (..) void OSTimeset (..) unsigned int OSTimeGet (void) Must call before running a task Called for blocking a task Called for resuming a blocked task When system time is to be set Find present count when time is read

10. List the Time delay functions in MUCOS. MUCOS Time delay functions are,
void OSTimeDly (…) unsigned byte OSTimeDlyResume (…) void OSTimeDlyHMSM (…) To delay a task by count-1 value To resume a task after a preset delay Time delay to block a task


© NSS, VVCET. 2010

Embedded Systems- QB 11. List the Memory related functions in MUCOS. MUCOS memory related functions are,
OSMem *OSMemCreate (…) void *OSMemGet (..) unsigned byte OSMemQuery (..) unsigned byte OSMemPut (…) To create and initialize memory partition To find the pointer of memory control block To find pointers of memory blocks and data structures To return a pointer of memory block

12. List the Semaphore related functions in MUCOS. MUCOS semaphore related functions are,
OS_Event OSSemCreate (…) void OSSemPend (..) unsigned short OSSemAccept (..) unsigned byte OSSemPost (…) unsigned byte OSSemQuery (…) To create and initialize a semaphore To check whether a semaphore is pending To check whether SemVal > 0 If SemVal = 0 or more, increments, and makes a semaphore again not pending. To get semaphore information

When a semaphore created by OS and used a resource acquiring key, it must be initialized with “1” to indicate the resource is available.

13. What is a signal in the RTOS environment? A signal is a flag like intimation to RTOS for development of certain situations during a run that need urgent attention by executing as ISR.

14. What is meant by task delay? Time delay is the minimum number of system ticks that a task must wait.

15. What is meant by task resumption? Task can be scheduled when its turn comes, which was delayed or suspended earlier.

16. What are the different types of scheduling supported by MUCOS? The different types of scheduling supported by MUCOS are, (i) Round robin time sliced scheduling. (ii) Preemptive scheduling.


© NSS, VVCET. 2010

Embedded Systems- QB 17. Explain briefly about the system timer in MUCOS. There are functions for initiating the system time in MUCOS. Starting a multitasking system by a first and later suspending if forever is shown as a technique in programming for a multitasking system.

18. Briefly explain the features supported for mailbox by MUCOS. MUCOS has mailbox functions and a simple feature that a mailbox has one message pointer per mailbox. There can be any number of messages or bytes, provided the same pointer accesses them.

19. Explain briefly the queue functions adapted in MUCOS. A queue in MUCOS receives from a sender task and array of message pointers. Message pointers insertion can be such that later on it can retrieve in FIFO method as well as in LIFO method from a queue. It depends on whether the post was used or post front function was used, respectively. This helps in taking notice of a high priority message at the queue.

20. List the tasks involved in Automatic Chocolate Vending Machine (ACVM). Task_ReadPorts Task_Collect Task_Deliver Task_Refund Task_ExcessRefund Task_Display Task_TimeDateDisplay Waits for Coins & Action as per coins collected Collect coins >= cost, wait till timeout Deliver the chocolate Refund coins, if coins are inserted in shortage Refund coins, if coins are inserted in excess Display the present operation & status Updates the display of Time & date in 3rd line of the LCD display

21. Draw the task synchronization model in ACVM.


© NSS, VVCET. 2010

Embedded Systems- QB 22. What is Cruise control? Cruise control is a system that takes charge of controlling the throttle from the driver and cruising the vehicle at a present constant speed. Cruising control may also maintain the steering stability in case of multiple cars streaming through highways or in case of VIP convoys. Cruise control relieves the driver from the duty and driver hands over the charge to ACC when the road conditions are suitable, and if the car is cruising at high speed when there is no heavy traffic. The driver resumes the charge in adverse conditions.

23. List the main components of Automatic Cruise Control (ACC). Cruise control panel Vacuum actuator Throttle position sensor Throttle valve Cruise control system (Embedded System) with inputs from steering wheel, vehicle speedometer, clutch pedal and brake pedal.

24. List the important hardware standards used in Automotives. A hardware system in automotive electronics has to provide functional safety. Important hardware standards and guidance provided at present are the following. TTP – Time Triggered Protocol CAN – Controller Area Network MOST – Media Oriented System Transport IEE guidance standard exists for EMC and functional safety.

25. Explain the function of Port_Align and Port_Ranging in ACC. Port_Align: It is a stepper motor port. Motor steps up clockwise or anticlockwise on an interrupt signal. The motor helps in aligning the radar in line with the front-end car.

Port_Ranging: It is a port that determines the range of the front-end car through time difference. Radar emits a signal and sensor receives the reflected signal from the front-end car. The time delay between the above two instances are measured and the range distance of the front-end car is calculated by multiplying the delay with the speed of the car.


© NSS, VVCET. 2010

Embedded Systems- QB 26. List the special requirements needed in embedded software & RTOS for the automotive system over and above the features of MUCOS. Language can be application specific, and need not be just C / C++. OS should be scalable for optimizing memory needs. OS should be able to schedule Tasks and ISR in distinct ways. Interrupt system should get disabled at the beginning and enabled on return. Tasks can be scheduled in real-time. Task can consist of three type of objects, event (semaphore), resource (statement and functions) and devices. Timer, task or semaphore objects creation and deletion cannot be allowed. IPC, message queue posting by a task is not allowed as a waiting task may wait indefinitely for its entire message needs. Before entering a critical section, interrupt system must be disabled.

27. List the software standards used in automotive electronics. Software used in automotive electronics must be to industrial standard. The industry standards are, AMI-C (Automotive Mutli-media interface important software standards and guidance. Collaboration) for

MISRA-C (Motor Industry Reliability Association Standard) for C language software guidelines for automotive systems. OSEK/VDX for RTOS, Communication and Network management.

28. What is Smart Card? Smart card is an embedded system-on-chip (SOC) consisting of microcontroller and EEPROM memory which is used for bank ATM operations, identification, and other innovative applications.

29. List the contents stored in ROM of smart card. Fabrication key Personalization key RTOS codes Application codes Utilization lock


© NSS, VVCET. 2010

Embedded Systems- QB 30. List the contents stored in EEPROM / Flash memory of smart card. Personal Identification Number (PIN) for user Unblocking PIN for use by authorizer (bank) Access conditions Card user – personal data Post issuing data that application generates Application’s non-volatile data Invalidation lock to lock card after expiry / theft

31. Describe the I/O system of the smart card. I/O system of the chip and the host interact through asynchronous serial UART at 9.6 / 106 / 115.2 bauds. The communication between the chip and the host may be through gold contacts or contact less through BPSK modem operating at 13.66 MHz with 10% modulation index.

32. List special features needed in embedded software for smart card. Protected environment (data stored in protected part of ROM) Restricted Run-time environment OS must be scalable in all aspects Code size generated should be optimum Limited use of data types Three layered file system for data (master, elementary & dedicated) Fixed length or variable length file management system with predefined offset. It should have classes for networks, sockets, connections, data grams, character I/O streams, digital certification, DES/AES based cryptography and digital signatures.


© NSS, VVCET. 2010

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.