61783774 Embedded System Question Bank BE ECE VII Semester R2008
-
Upload
bhuvaneswari-balachander -
Category
Documents
-
view
74 -
download
3
Transcript of 61783774 Embedded System Question Bank BE ECE VII Semester R2008
ANNA UNIVERSITY OF TECHNOLOGY – COIMBATORE
B.E. (Electronics and Communication Engg.)
VII Semester
R2008 Regulation
EMBEDDED SYSTEMS
(2 Marks - Question Bank)
Prepared By
Prof. N.SHANMUGASUNDARAM
Professor & Head, Department of ECE,
VIDYAA VIKAS COLLEGE OF ENGINEERING AND TECHNOLOGY, TRICHENGODE, NAMAKKAL DISTRICT
TAMIL NADU - 637214.
Email: [email protected]
Embedded Systems-QB
© NSS, VVCET - 2011 2
EMBEDDED SYSTEMS
UNIT I ARCHITECTURE OF EMBEDDED SYSTEMS 9
Categories of Embedded Systems-Specifications of Embedded systems-Resent trends in Embedded
Systems-Hardware Architecture-Software Architecture-Communication software-Process of
generation of executable image-development/testing tools.
UNIT II PROGRAMMING FOR EMBEDDED SYSTEMS 9
Getting the most of C-data types-manipulating bits in memory and I/O ports-accessing 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
allocation shared 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 action- Oscillatory connection-
Memory organization- Instructions- Addressing modes- I/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 Routines- Semaphores-Mutex-
Mailboxes-Message Queues-Event Registers-Pipes-Signals-Timers-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.
TOTAL: 45 TUTORIAL : 15
TEXT BOOKS:
1. K.V.K.K.Prasad “Embedded /Real-Time Systems: Concepts, Design and Programming” Dream tech, 2003.
2. Ajay V Deshmukh “Microcontroller Theory and Applications” Tata McGraw Hill 2005
REFERENCES:
3. Raj Kamal “Embedded Systems Architecture Programming and Design” 2/e TMH, 2008
4. David E Simon “An Embedded Software Primer” Pearson Education 2003
5. Daniel 5.W Lewis, “Fundamentals of Embedded Software” Pearson Education- 2001
6. Peatman “Designing with PIC Micro Controller”, Pearson 2003
Embedded Systems-QB
© NSS, VVCET - 2011 3
UNIT I
ARCHITECTURE OF EMBEDDED SYSTEMS
1. Define Embedded System.
An embedded system is one that has computer hardware with software embedded on it and
designed for a specific task.
An embedded system can be defined as a computing device that does a specific focused job.
Applications such as the air conditioner, VCD player, printer, fax machine, etc. are some of the
examples of embedded system.
Each of these applications will have a processor and special hardware to meet the specific
requirement of the application along with embedded software that is executed by the
processor for meeting that specific requirement.
2. List application areas of Embedded Systems.
Various application areas of embedded systems are...
� Consumer appliances
� Office automation
� Industrial automation
� Medical electronics
� Computer networking
� Telecommunication
� Wireless technologies
� Instrumentation
� Security
� Finance
3. What are the different categories of embedded system?
Based on the functionality and performance requirements, embedded systems can be
categorized as
� 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.
4. What are the classifications of Embedded system?
Based on complexity of hardware and software, size and capability, the embedded systems are
classified as follows.
� Small scale Embedded System
� Medium scale Embedded System
� Sophisticated Embedded System.
Embedded Systems-QB
© NSS, VVCET - 2011 4
5. 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
6. List the specialties of embedded systems.
As compared to desktop computers, workstations or mainframes, embedded systems have
many specialties. Developers need to keep these specialties in mind while designing
embedded systems. They are,
� Reliability
� Performance
� Power consumption
� Cost
� Size
� Limited user interface
� Software upgradation capability
7. List the factors to be considered while evaluating the processor for embedded system.
� Clock Speed
� Width and Number of Registers
� Width of Data and Address bus
� Internal RAM & ROM
� Interrupt lines
� On-chip peripherals such as Timers, UART, ADC, DAC, etc.
8. What are the hardware components of embedded systems?
� Processor
� Memory
� Timers & Interrupt Controller
� Serial/Parallel Ports
� Input devices, Interfacing/Driver circuits
� Output Interfacing/Driver circuits
� Power supply, Reset & Oscillator circuits.
Embedded Systems-QB
© NSS, VVCET - 2011 5
9. Define processor.
A processor is a IC, which is capable of performing an arithmetic or logical operation on a given
data as per the command given to it.
10. 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. With less instructions, a task can be performed 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.
11. What are the three processor architectures in embedded systems?
Von-Neuman Architecture:
This architecture has common memory for both data and program codes.
Embedded Systems-QB
© NSS, VVCET - 2011 6
Harvard Architecture:
In this architecture, there are separate memories blocks, one is program memory and the
other is data memory. Program memory stores only instructions and data memory stores
only data. Two pairs of data buses are used between CPU and the memory blocks.
Super Harvard Architecture:
The super Harvard architecture (SHARC) is a slight, but significant modification of the
Harvard architecture. In Harvard architecture, the data memory is accessed more
frequently than the program memory. Therefore, in SHARC, provision has been made to
store some secondary data in the program memory to balance the load on both memory
blocks.
12. What is Microcontroller?
A microcontroller is a single IC with a processor and several other on-chip peripherals such as
RAM, ROM, Comm. Ports, TIMERS, ADC/DAC, etc.
Compact size of microcontroller suits the requirements for embedded systems and hence
widely used in most of the embedded applications.
13. What are the functional blocks of a microcontroller?
The functional circuits of a microcontroller are,
� Processor
� internal RAM for Data & stack
� Timers & Watchdog timer
� ROM / PROM / EPROM
� External Memories Interfaces
� I/O Ports Control & Interfaces / Drivers
� Serial UART communication port
14. 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.
Embedded Systems-QB
© NSS, VVCET - 2011 7
15. 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.
16. 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.
17. What is System-On-Chip?
A complete system on a single VLSI chip that comprises of all needed analog as well as digital
circuits in it. For example, mobile phone.
18. What are the various forms of system memories?
� Internal RAM
� Internal ROM / PROM /EPROM
� External RAM
� External ROM / PROM
� Internal & External Caches
� Hybrid memory such as E2PROM, NV-RAM or flash memory
19. 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
20. List the important types of Displays.
� Light Emitting Diode (LED)
� Liquid Crystal Display (LCD)
� Thin Film Transistor (TFT) Display
� Organic Light Emitting Diode (OLED)
21. List the important Serial communication protocols.
� Inter-integrated Circuit (I2C)
� Serial Peripheral Interface (SPI)
� Universal Serial Bus (USB)
� Controller Area Network (CAN)
Embedded Systems-QB
© NSS, VVCET - 2011 8
22. 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
23. Define interrupt handler.
It is a unit that handles the processor operations arising out of an interrupt from a source.
24. What is watchdog timer?
It is a timer which resets the processor in case the program gets struck for an unexpected
time, with the help of timeout signal.
25. 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.
26. What are the different categories of embedded operating system?
Operating system used in embedded system can be broadly divided into the following
categories
� Non-real-time embedded operating system
� Real-time operating system
� Mobile/handheld operating system
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
Embedded Systems-QB
© NSS, VVCET - 2011 9
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, scheduling of tasks,
management of resources like memory, devices, etc. to meet time deadlines in embedded
systems.
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
32. 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.
33. What are the steps required for converting assembly language into a ROM image?
� Assembler
� Linker
� Loader
� Locator & Device Programmer
Embedded Systems-QB
© NSS, VVCET - 2011 10
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.
37. 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.
38. 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.
40. List the various hardware development / testing tools.
Digital Multimeter : Measures current, voltage, continuity of connections
Logic Analyzer : Checks the timing of the signals
Oscilloscope : Analyze the waveforms in time domain
Spectrum Analyzer : Analyze the waveforms in frequency domain
41. 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
Embedded Systems-QB
© NSS, VVCET - 2011 11
43. 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.
44. List out the layers of TCP/IP protocol suite.
The TCP/IP protocol suit consist of 5 layer
� Application layer
� Transport layer
� Internet protocol (IP) layer
� Data link layer(referred also as network layer)
� Physical layer
Embedded Systems-QB
© NSS, VVCET - 2011 12
UNIT II
PROGRAMMING FOR EMBEDDED SYSTEMS
1. 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
2. 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.
3. 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.
4. 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.
5. What is the use of type checking?
Type checking makes the program less prone to error.
For e.g. It does not allow subtraction, multiplication and division on the ‘char’ data types.
6. 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.
7. 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.
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.
Embedded Systems-QB
© NSS, VVCET - 2011 13
9. 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.
18. What is meant by platform independence?
A code that can port on different machine and different operating systems is said to be
platform independent code.
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.
Embedded Systems-QB
© NSS, VVCET - 2011 14
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 Size Range
unsigned
Char
Short int
Int
Long int
8 bits
16 bits
16/32 bits
32 bits
0 to 255
0 to 65,535
same as unsigned short / long int
0 to 4,294,967,295
signed
Char
Short int
Int
Long int
8 bits
16 bits
16/32 bits
32 bits
-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.
24. List the Boolean and Bitwise operators.
Operation Boolean
Operator
Bitwise
Operator
AND
OR
XOR
NOT
&&
||
(Not supported)
!
&
|
^
~
Embedded Systems-QB
© NSS, VVCET - 2011 15
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
b) Bitwise: (5 | !3) & 6 Ans:= (00000101 OR !(00000011)) AND 00000110
= (00000101 OR 11111100) AND 00000110
= (11111101) AND 00000110
= 00000100
= 4
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 of a variable. This helps to access the
data of a variable faster in memory and in particular for array types of data.
Eg. Int A, *B, C ; A & C are normal variable and B is a Pointer variable
A = 10 ; Variable A is assigned with a value, 10
B = &A ; Variable B is assigned the address of variable A
C = *B ; Variable C is now assigned the content at address
stored in variable B
28. What is an Array?
An Array is an aggregate data type composed of several members of same data type.
The consecutive locations in memory are allocated for an array. The starting address of the
array (i.e., a[0]) is called Base address.
Eg. Int a[5];
a[0] a[1] a[2] a[3] a[4]
Embedded Systems-QB
© NSS, VVCET - 2011 16
29. Explain about manipulating bits in memory.
30. How testing a bit is made?
31. How setting a bit is made?
Embedded Systems-QB
© NSS, VVCET - 2011 17
32. How clearing of a bit is made?
33. How inverting a bit is made?
34. How to extracting of a bit is made?
35. How to replacing of a bit is made?
Embedded Systems-QB
© NSS, VVCET - 2011 18
36. 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;
};
Structure variable declaration struct PERSON sue;
(or)
PERSON sue;
Initialization of
structure variable members sue.age = 25;
sue.gender = ‘F’;
(or)
PERSON sue = {25, ‘F’};
37. 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;
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));
padding padding padding x.c
x.i
x.c
x.i
Embedded Systems-QB
© NSS, VVCET - 2011 19
38. 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 {
WORD16 seconds : 6,
minutes : 5,
hours : 5;
} TIME time1;
Time of 13:34:18 can be initialized into the packed representation time1 using simple
reference operator as follows,
time1.hours = 13;
time1.minutes = 34;
time1.seconds = 18/2;
39. 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;
31 16 15 0
result.part.whole result.part.fract
�--------------------------- result.real ----------------------------�
40. 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.
Embedded Systems-QB
© NSS, VVCET - 2011 20
41. 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.
42. 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.
43. List the Intel conditional JUMP instructions.
For comparing unsigned operands
JA/JNBE - Jump if above / jump if not below or equal
JAE/JNB - Jump if above or equal / jump if not below
JBE/JNA - Jump if below or equal / jump if not above
JB/JNAE - Jump if below / jump if not above or equal
For comparing signed operands
JG/JNLE - Jump if Greater / jump if not less or equal
JGE/JNL - Jump if Greater or equal / jump if not less
JLE/JNG - Jump if less or equal / jump if not greater
JL/JNGE - Jump if less / jump if not greater or equal
For equality comparisons
JE/JZ - Jump if equal / jump if zero (ZF=1)
JNE/JNZ - Jump if not equal / jump if not zero (ZF=0)
Other JUMP instructions
JC - Jump if CF=1
JNC - Jump if CF=0
JS - Jump if SF=1
JNS - Jump if SF=0
Embedded Systems-QB
© NSS, VVCET - 2011 21
44. List the attributes of Objects stored in memory.
Type - char, int, unsigned int, etc.
Name - The identifier used to access the object
Value - The data held within the object
Address- The address in memory where the object resides
Scope - That part of the source code where the object’s name is recognized
Lifetime- The notion of when the object is created and destroyed,
and thus, when it is available for use.
45. 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.
46. List the types of Memory allocation available in C.
Method Object is
created Object is initialized Object is destroyed
Automatic
Each time the program
enters
the function in
which it is declared
If specified in the
declaration,
initialization occurs each
time the program enters
the block
Each time the function
returns
Static
Once:
When the program is
first loaded into the
memory
Once:
Just before
the program
starts to run
Once:
When the
program stops
Dynamic
By calling the library
function
malloc()
By writing executable
statements that modify
its content
By calling the library
function
free()
47. 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.
Embedded Systems-QB
© NSS, VVCET - 2011 22
48. 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.
49. 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.
50. 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.
51. What is meant by Life Time of a variable?
52. What is Fragmentation?
Embedded Systems-QB
© NSS, VVCET - 2011 23
UNIT III
HARDWARE PLATFORM
1. In what way is PIC microcontroller different from 8051?
Most PIC microcontrollers are RISC based processors with Harvard architecture, where as
8051 is based on Von-Neuman architecture. Harvard architecture makes use of separate
program and data memories. PIC microcontroller has different data size for program and
data memory and hence it is difficult to use external memory for PIC microcontroller.
2. List the features of PIC 16C6x/7x.
� PIC microcontroller is designed in Harvard Architecture
� Separate memory for program and data
� Program memory: has 13-bit address & 14-bit data bus
� Data memory: has 8-bit address & 8-bit data bus
� 13-bit program counter
� Pipelined architecture for fast execution speed
� Has inbuilt ADC and Watch-dog timer
3. Compare features of other PIC microcontrollers.
Embedded Systems-QB
© NSS, VVCET - 2011 24
4. Draw the pin diagram of 16C61 and 16C71 microcontroller.
5. Describe the status register (Flag Reg) of PIC16C6X microcontroller.
STATUS register contains various flags and register bank select bits:
D7 D6 D5 D4 D3 D2 D1 D0
- - RPO TO PD Z DC C
RPO – Register bank select (to select 2 banks; one bit RPO is sufficient)
TO – Time-Out Bit (Reset status bit, is only readable)
PD – Power-Down Bit (Reset status bit, is only readable)
Z – Zero bit
DC – Digital-carry / Borrow bit
C – Carry / Borrow bit
6. State the power consumption of PIC microcontroller.
Embedded Systems-QB
© NSS, VVCET - 2011 25
7. What is meant by instruction pipelining?
PIC16C6x/7x family of microcontrollers use Harvard Architecture and instruction pipelining to
achieve exceptionally fast execution speed for a given clock rate. Through pipelining,
instruction fetch and execution are carried out simultaneously in a single cycle.
8. List the CPU registers of 16Cxx family microcontrollers.
9. What is PCL and PCLATH register?
PC, the program counter of PIC microcontroller is 13-bits wide and PCL is the lower byte of
the PC. PCLATH, stand for PC Latch and it holds the upper 5-bits of the program counter.
PCLATH is transferred into the PC when content is written into PCL.
Embedded Systems-QB
© NSS, VVCET - 2011 26
10. List the SFRs of PIC microcontroller.
The lower bytes of register bank are identified as Special Function Register (SFRs). The CPU
and peripheral modules use SFRs for controlling the operation of the device.
11. Describe the Register file structure in PIC microcontroller.
The term Register File is PIC terminology used to denote the locations that an instruction can
access via an address. The register file consists of two components.
1. General purpose register file
2. Special purpose register file
Embedded Systems-QB
© NSS, VVCET - 2011 27
The general purpose register file is another name given to RAM memory of PIC
microcontroller. The special purpose register file contains input and output ports as well as
the control registers used to establish each bit of a port as either an input or an output.
The register file structure is illustrated in figure below with addresses that span the 8-bit
range from ‘00’ to ‘FF’. Because the direct addressing mode employed by many instructions
use only 7-bit of the instruction to identify a register file address, the 8th bit of the register
file address must come from a separate register bank selection bit, RP0.
12. List and brief the addressing modes in PIC microcontroller.
Direct Addressing: It uses 7 bits of instruction and the 8thbit from RP0.
If RP0 bit is 0; then bank 0 is selected or otherwise bank 1 is selected.
Indirect addressing: In this mode; the 8-bit address of the location in register file to be
accessed is written in FSR and INDF register is used for indirect addressing.
13. What is FSR?
FSR stands for File Selection Register. FSR is the pointer used for indirect memory addressing
in the whole register file.
It must be noted that, in PIC, every instruction that can be used for direct addressing may
also be used in a different way for indirect addressing. The only difference in indirect
addressing mode is that one has to write the address byte in FSR and then use INDF in the
instruction. Thus, FSR points to the desired memory location.
14. List the reset action that takes place in PIC microcontroller.
PIC reset action takes place due to difference mechanism. Those are
• Power–on–reset (POR),
• MCLR reset during the normal operation,
• Master clear MCLR reset during SLEEP mode,
• Watch dog timer reset during normal operation,
• Brown–out–reset (BOR).
15. Explain the brown-out reset feature of PIC microcontroller.
PIC microcontroller can be reset automatically in running condition, due to the brown-out.
Brown-out reset takes place when the supply voltage falls below 4V. The device remains in
brown-out reset condition until the supply voltage is restored. PIC 16C61 and 16C71 does not
support this feature.
Embedded Systems-QB
© NSS, VVCET - 2011 28
16. Explain the structure of Watchdog timer in PIC microcontroller.
Watch-dog timer is a simple timer circuit that prevents the processor from endless loop
(hanging condition) and looks after the functioning of the system with respect to time. The
watch-dog timer will reset the PIC microcontroller when the ‘CLRDWT’ instruction is not
executed periodically.
CLRDWT instruction resets the TO bit in the status register. WDT timer can also be reset the
TO bit, when the CLRDWT is not executed periodically. The normal time-out period of PIC
microcontroller is around 18ms. The watch-dog timer is enabled at the time of device
programming and it cannot be turned off after programming.
17. Explain about Clock generation in PIC briefly.
Embedded Systems-QB
© NSS, VVCET - 2011 29
Alternate method of generating clock signal is by connecting quartz crystal to the PIC
microcontroller along with two start-up capacitors.
18. Short notes on I/O ports of PIC microcontroller
Port A: RA0 to RA4 (5 lines) (Address 05). RA4 has alternate function. TRISA (85H) is SFR used
to configure these lines individually as either inputs or outputs. Setting bit in TRIS will
configure as input and 0 will configure as output.
Port B: RB0 to RB7 (8 lines). TRISB It has weak internal pull up which is to be enabled. POR
disables pull-ups.
19. Explain about the interrupts in PIC
There are 3 Interrupt Sources for PIC16C6X.
External Interrupt: Due to external source. Edge Sensitive RB0/INT causes this interrupt. This
interrupt wakes up processor from SLEEP. This must be set before going into SLEEP mode.
Timer 0: Timer 0 overflows when timer count overflows from FF to 00.
Port B Change Interrupt: A change from high to low or low to high on port B pins RB4 to RB7
causes this interrupt. This interrupt can wake device from SLEEP.
20. Write short notes on Timers in PIC16C6X.
All PIC16C6X devices have three timer modules except for the PIC16C61, which has one timer
module.
The Timer0 module is a simple 8-bit overflow counter. The clock source can be either the
internal system clock (Fosc/4) or an external clock. When the clock source is an external
clock, the Timer0 module can be selected to increment on either the rising or falling edge.
Embedded Systems-QB
© NSS, VVCET - 2011 30
21. List out the types of instructions in PIC Microcontroller.
Each PIC16CXX instruction is a 14-bit word divided into an OPCODE which specifies the
instruction type and one or more operands which further specify the operation of the
instruction.
� Byte-oriented,
� Bit-oriented,
� Literal and control operations
22. Explain Byte-oriented instruction set.
Byte-oriented instructions, 'f' represents a file register designator and ‘d’ represents a
destination designator. The file register designator specifies which file register is to be used
by the instruction. The destination designator specifies where the result of the operation is
to be placed. If ‘d’ is zero, the result is placed in the W register. If ‘d’ is one, the result is
placed in the file register specified in the instruction.
23. Explain Bit-oriented instruction set.
Bit-oriented instructions, 'b' represents a bit field designator which selects the number of the
bit affected by the operation, while 'f' represents the number of the file in which the bit is
located.
24. Short note on literal and control operation instruction set.
Literal and control operations, 'k' represents an eight or eleven bit constant or literal value.
Embedded Systems-QB
© NSS, VVCET - 2011 31
25. Write short notes on INTCON register of PIC16C6x/7x controller.
INTCON is an Interrupt control register in PIC microcontrollers for controlling all interrupts.
Embedded Systems-QB
© NSS, VVCET - 2011 32
26. 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.
27. List the features of ADC in PIC 16C6x/7x microcontroller.
PIC 16C7X supports analog inputs. PIC 16C71 microcontroller has four analog channels of 8-
bit ADC, with 20 µs of conversion time per channel. Four analog channels AIN0, AIN1, AIN2
and AIN3 are the alternate functions of Port_A pins RA0, RA1, RA2, and RA3 respectively.
ADCON0 controls the function of pins RA0 to RA3. This allows the configuring pins RA0-RA3
as analog or digital inputs.
29. What is sleep mode in PIC microcontroller?
PIC microcontroller supports a power saving ‘Sleep mode’. The clock may be frozen with all
the data preserved in the processor memory. A software command allows the processor to
enter into this mode. It will be in sleep mode until the PIC is reset again.
Embedded Systems-QB
© NSS, VVCET - 2011 33
30. Explain the operation of OPTION register.
Embedded Systems-QB
© NSS, VVCET - 2011 34
31. Instruction set of PIC microcontroller.
Embedded Systems-QB
© NSS, VVCET - 2011 35
32. Programming examples for PIC microcontroller.
A. Program to configure PORT_B using TRISB
B. Program to implement a Delay routine.
Embedded Systems-QB
© NSS, VVCET - 2011 36
C. Program to initialize PORT_A
D. Program to initialize PORT_B
Embedded Systems-QB
© NSS, VVCET - 2011 37
E. Program to alter PORT_B in response to external interrupt on pin RB0
Embedded Systems-QB
© NSS, VVCET - 2011 38
F. Program for A/D conversion.
Embedded Systems-QB
© NSS, VVCET - 2011 39
UNIT IV
REAL TIME OPERATING SYSTEMS CONCEPTS
1. Define RTOS.
It is an operating System for embedded system with real time task scheduling, interrupt-
latency control, synchronization of tasks with IPCs and predictable timing behavior of the
system.
2. Name some RTOS services.
(i) Basic OS functions
(ii) RTOS Main functions (Task Scheduling & interrupt latency control)
(iii) Time Management
(iv) Predictability
3. 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.
4. What is Round Robin or cyclic scheduling?
It is a scheduling algorithm in which the tasks are scheduled in sequence from a list of ready
tasks.
5. 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.
6. What is Time Slicing and Fixed real time scheduling?
Time Slicing Scheduling
It is 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
It is a scheduling strategy in which the time for each task is fixed.
7. 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.
Embedded Systems-QB
© NSS, VVCET - 2011 40
8. 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.
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.
Embedded Systems-QB
© NSS, VVCET - 2011 41
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.
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
Embedded Systems-QB
© NSS, VVCET - 2011 42
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 client-server or peer-to-
peer environment.
Embedded Systems-QB
© NSS, VVCET - 2011 43
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
Embedded Systems-QB
© NSS, VVCET - 2011 44
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.
Embedded Systems-QB
© NSS, VVCET - 2011 45
UNIT V
REAL TIME OPERATING SYSTEMS TOOLS AND CASE STUDIES
1. Name the important RTOS used in embedded systems.
MUCOS, Vxworks, PSoS, RTX51, WinCE, RT Linux, Nucleus, Symbian are the important RTOS.
2. List the Main functions of RTOS.
(i) Handling of interrupts.
(ii) Task scheduling.
3. 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.
4. 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.
Embedded Systems-QB
© NSS, VVCET - 2011 46
5. Explain µC/OS-II (MUCOS) RTOS.
� µC/OS-II is a freeware RTOS, developed by Jean J. Labrosse in 1992.
� µC/OS-II is designed for non-commercial use.
� µC/OS-II is well documented for developer’s reference.
� µC/OS-II codes are written in C and in assembly language.
� µC/OS-II code ports on any processor that are used for embedded systems
6. What are the files associated with µC/OS-II RTOS?
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.
7. List the features of µC/OS-II (MUCOS) RTOS.
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.
Embedded Systems-QB
© NSS, VVCET - 2011 47
8. List the System level functions in MUCOS.
MUCOS support the following system level functions.
void OSInit (void) At the beginning prior to OSStart()
void OSStart (void) After OSInit() and task creating functions
void OSTickInit (void) To initialize System timer ticks
void OSIntEnter (void) Just after the start of ISR codes
void OSIntExit (void) before return form the ISR codes
OS_ENTER_CRITICAL Macro to disable all interrupts
OS_EXIT_CRITICAL Macro to enable all interrupts
9. 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 (…) Must call before running a task
unsigned byte OSTaskSuspend (..) Called for blocking a task
unsigned byte OSTaskResume (..) Called for resuming a blocked task
void OSTimeset (..) When system time is to be set
unsigned int
OSTimeGet (void) Find present count when time is read
10. List the Time delay functions in MUCOS.
MUCOS Time delay functions are,
void OSTimeDly (…) To delay a task by count-1 value
unsigned byte OSTimeDlyResume (…) To resume a task after a preset delay
void
OSTimeDlyHMSM (…) Time delay to block a task
Embedded Systems-QB
© NSS, VVCET - 2011 48
11. List the Memory related functions in MUCOS.
MUCOS memory related functions are,
OSMem
*OSMemCreate (…) To create and initialize memory partition
void *OSMemGet (..) To find the pointer of memory control block
unsigned byte
OSMemQuery (..) To find pointers of memory blocks and data structures
unsigned byte
OSMemPut (…) To return a pointer of memory block
12. List the Semaphore related functions in MUCOS.
MUCOS semaphore related functions are,
OS_Event
OSSemCreate (…) To create and initialize a semaphore
void OSSemPend (..) To check whether a semaphore is pending
unsigned short OSSemAccept (..) To check whether SemVal > 0
unsigned byte
OSSemPost (…)
If SemVal = 0 or more, increments, and makes a semaphore
again not pending.
unsigned byte OSSemQuery (…) 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.
Embedded Systems-QB
© NSS, VVCET - 2011 49
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 Waits for Coins &
Action as per coins collected
Task_Collect Collect coins >= cost, wait till timeout
Task_Deliver Deliver the chocolate
Task_Refund Refund coins, if coins are inserted
in shortage
Task_ExcessRefund Refund coins, if coins are inserted
in excess
Task_Display Display the present operation & status
Task_TimeDateDisplay Updates the display of Time & date
in 3rd line of the LCD display
21. Draw the task synchronization model in ACVM.
Embedded Systems-QB
© NSS, VVCET - 2011 50
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.
Embedded Systems-QB
© NSS, VVCET - 2011 51
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 Collaboration) for important software
standards and guidance.
� 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
Embedded Systems-QB
© NSS, VVCET - 2011 52
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.