Model Answer Paper Summer 2018
Model Answer Paper Summer 2018
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
MODEL ANSWER
SUMMER– 18 EXAMINATION
Subject Title: EMBEDDED SYSTEM
Important Instructions to examiners:
Subject Code:- 17658
1) The answers should be examined by key words and not as word-to-word as given in the model answer
scheme.
2) The model answer and the answer written by candidate may vary but the examiner may try to assess the
understanding level of the candidate.
3) The language errors such as grammatical, spelling errors should not be given more Importance (Not
applicable for subject English and Communication Skills.
4) While assessing figures, examiner may give credit for principal components indicated in the figure. The
figures drawn by candidate and model answer may vary. The examiner may give credit for any equivalent
figure drawn.
5) Credits may be given step wise for numerical problems. In some cases, the assumed constant values may
vary and there may be some difference in the candidate’s answers and model answer.
6) In case of some questions credit may be given by judgement on part of examiner of relevant answer based
on candidate’s understanding.
7) For programming language papers, credit may be given to any other program based on equivalent concept.
The 89c51 has 128 byte internal RAM and divided into 3 parts/area.
In first part :
32 bytes from addresses 00H to 1FH i.e. 32 registers organised in 4 banks. Each
bank contains 8 registers (each of 8 bit) and available at each address.
Registers are named as:
Page1
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
ii) State the function of simulator, linker compiler and debugger. 4 Marks
Compiler :-
1. It is program which converts high level language program to machine
language.
2. It also indicates the syntax errors in the program if any.
3. It generates object file corresponding to the target device.
Debugger :-
1. Debugger is used to find the error and it keeps the control over the system
environment and ability to test or follow the execution of the program.
2. Debugger allows the user to load program in to the system memory, executes the
Page2
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
PCI-X :-
It is an extension of PCI bus and supports 64 bit, 100MHz transfer. PCI – X is revised
to double the maximum clock speed to improve the data exchange transfer between
processor and peripherals. The data exchange rate is 1.06 gbps.
iv) Draw a labelled interfacing diagram of ADC 0808 with 8951 microcontroller. 4 Marks
Note: Any labeled diagram showing handshaking signal of ADC (Data bus,
Channel Select, ALE,START, end of conversion, output enable ) Any port of
89C51 is considered for interfacing.
Page3
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Description of
each 2 marks
( any two)
Small scale:-
8 bit or 16 bit microcontroller is used. These types of embedded systems are designed
with a single 8 or 16-bit microcontroller that may even be activated by a battery. For
developing embedded software for small scale embedded systems, the main
programming tools are an editor, assembler, cross assembler and integrated
development environment (IDE).
Medium scale:-
16 bit or 32 bit microcontroller or microprocessor is used. Such as DSP, RISC. These
types of embedded systems design with a single or 16 or 32 bit microcontroller, RISCs
or DSPs. These types of embedded systems have both hardware and software
complexities. For developing embedded software for medium scale embedded systems,
the main programming tools are C, C++, and JAVA, Visual C++, and RTOS, debugger,
source code engineering tool, simulator and IDE.
Networked :-
These types of embedded systems are related to a network to access the resources. The
connected network can be LAN, WAN or the internet. The connection can be any wired
or wireless. This type of embedded system is the fastest growing area in embedded
system applications. The embedded web server is a type of system wherein all embedded
devices are connected to a web server and accessed and controlled by a web browser.
Example for the LAN networked embedded system is a home security system
wherein all sensors are connected and run on the protocol TCP/IP Embedded
System
Stand-alone :-
This embedded systems do not require a host system like a computer, it works by itself.
It takes the input from the input ports either analog or digital and processes, calculates
and converts the data and gives the resulting data through the connected device-Which
either controls, drives or displays the connected devices. Examples for the stand alone
embedded systems are mp3 players, digital cameras, video game consoles, microwave
ovens and temperature measurement systems.
Page5
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
PREEMPTIVE KERNEL
Low Priority Task
(1) (2) ISR
High Priority Task
(4)
(3)
(5)
ISR makes the high
Priority task ready
Time
(6)
(7)
Round-robin scheduling:-
In the round robin algorithm, each process gets a small unit of CPU time (a time
quantum), usually 10-100 milliseconds. After this time has elapsed, the process is pre
empted and added to the end of the ready queue. If there are ‘ n’ processes in the ready
queue and the time quantum is ‘q’, then each process gets ‘1/n’ of the CPU time in
chunks of at most ‘q’ time units at once. No process waits more than ‘ (n-1)q’ time
units.
Performance of the round robin algorithm
q large then FCFS
q small then q must be greater than the context switch time; otherwise, the
overhead is too high
One rule of thumb is that 80% of the CPU bursts should be shorter than the time
quantum
OR
In the round robin algorithm, the kernel allocates a certain amount of time for each task
waiting in the queue . The time slice allocated to each task is called quantum. As shown
in fig. if three tasks 1,2, 3 are waiting in the queue the CPU first executes task1 then
task2 then task 3 and the again task1 in round robin algorithm each task waiting in the
queue is given a fixed time slice . The kernel gives control to the next task if the current
task has completed its work within the time slice or if the current task has completed it
allocated time The kernel gives control to the next task if
Page6
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
This algorithm is very simple to implement but there is no priorities for any task. All
tasks are considered of equal importance . If time critical operation are not involved then
this algorithm will be sufficient . Digital millimeter , microwave oven has this algorithm.
b) Explain the use of assembly language in C language with suitable example. 4 Marks
Ans: This is known as inline assembly which does not require separate assembly and link
steps. It is more convenient than separate a separate assembler. This uses the functions Uses(advantag
and variables of ‘c’ language. This helps to integrate the assembly language program ed
and ‘c’ language program easily. +) 2 Marks
Its uses following syntax Example 2
# include <reg51.h> marks
void main (void)
{
C Instructions;
# pragma asm
Assembly instructions
# pragma endasm
C Instructions;
Page7
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
d) A 230V AC bulb is connected through a relay at P2.2. A light sensor is connected 4 Marks
at P3.4. A light sensor produces logic high in dark condition. Write a ‘C’
program to switch ‘ON’ the bulb in ‘DARK’ condition and switch it OFF in
‘LIGHT’ condition.
Ans: # include<reg51.h> 4 Marks
sbit relay = P2^2; Any suitable
Page8
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
}
}
OR
# include<reg51.h>
sbit relay = P2^2;
sbit sensor = P3^4;
void main (void)
{
sensor=1; //P3.4 as input line
relay = 0; // Intially OFF
while (1)
{
if ( sensor == 1) // check sensor if dark //
relay = 1; // ON bulb//
else
relay=0;
}
}
Ans: Software is the basic building block of RTOS. Task is a simply subroutine. Task must
1 Marks for
be able to communicate with one another to coordinate their activities or to share the
basics of inter
data. Kernel object is used for inter task communication. Kernel objects uses message
task
queue, mail box and pipes, Shared Memory, Signal Function and RPC a for inter task communicatio
communication. n
3 marks for
Message queue:- its any three
A message queue is a buffer like data structure, through which tasks and ISRs methods
communicate with each other by sending and receiving messages and synchronize with ( short
Page9
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
data. It temporarily stores the message from a sender until the intended receiver is ready description is
to read them. A message queue has queue control block, queue name, unique ID, expected)
memory buffers, a queue length. Kernel allocates the memory for message queue, ID,
control block etc.
Mail box:-
In general, mailboxes are similar to message queues. Mail box technique for inter task
communication in RTOS based system used for one way messaging. The task/thread
creates mail box to send the message. The receiver task can subscribe the mail box. The
thread which creates the mail box is known as mailbox server. The others are known as
client. RTOS has function to create, write and read from mail box. No of messages
(limited or unlimited) in mail box have been decided by RTOS.
Pipes :-
Pipes are kernel objects used for unstructured data exchange between tasks facilities
synchronization among tasks. Pipe provides a simple data transfer facility.
Shared Memory :-
Shared memory is simplest way of inter process communication. The sender process
writes data into shared memory and receiver process reads data.
Signal Function:-
Operating system provides the signal function for messaging among task (process).
Ans: Diagram - 2
marks
Functional
description of
any four - 2
Marks
Page10
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
OR
Page11
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Processor:-
The processor is the heart of embedded system and selected as per application of interest.
Power supply is also called as “charge pump”. Power supply source or charge pump is
essential in every system .
Clock Oscillator Circuit and Clocking Units :- For processing unit, highly stable
oscillator is required and microprocessor clock out signal provides clock for
synchronizing all system unit with the processor. Reset and watch dog timer is also
available.
Page12
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
2. ZigBee operates in the industrial, scientific and medical (ISM) radio bands:
2.4 GHz in most jurisdictions worldwide.
3. Low duty cycle provides long battery life.
4. 250 Kbps data rate.
5. Scalable and easy deployment.
6. Highly reliable and secure.
7. Low latency.
8. Cost effective.
9. Up to 65000 nodes per network.
10. 128 bit AES encryption for secure data connections.
Collision avoidance, retries and acknowledgments.
b) Write a ‘C’ program to toggle P2.1 continuously with 100 ms delay. (Use simple 4 Marks
delay subroutine).
Ans: #include <reg 51.h>
void add_delay (unsigned int);
sbit data_bit = P2^1;
void main (void)
{
while (1)
{
data_bit =1; // set P2.1 bit
add_delay (100);
data_bit =0; // reset P2.1bit
add_delay (100);
}
}
c) Compare desktop operating system with RTOS with any four points. 4 Marks
Page13
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
responsiveness of an number of
application at unexpected services.
time.
5 Slow context switching fast context switching
Dis-Advantages:-
1. Hard for maintenance as it is use and throw device.
2. No technological improvement.
3. Hard to back up of embedded files.
4. Less power supply durability if it is battery operated.
e) Draw a labelled interfacing diagram of DAC 0808 with 8951 microcontroller. 4 Marks
Also write a ‘C’ program to generate triangular waveform using DAC.
Ans: Diagram -
2Marks
Program-
2Marks
#include<reg51.h>
unsigned char d;
void main(void)
{
while(1)
Page14
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
{
for(d=0; d<255; d++)
{
P1 = d;
}
for(d=255; d>0; d--)
{
P1 = d;
}
}
}
Value 2
marks
0 0 0 0 0 0 0 1
Gate C / T M1 M0 GATE C / T M1 M0
Ans: Controlled Area Network [CAN]:- Can is mainly used in automotive electronics. Frame format
CAN bus is a standard bus in distributed network. It has a bi-directional serial line which -2marks
receives or sends a bit at an instance by operating at maximum rate of 1Mbps. It employs
a twisted pair connection to each node. The pair can run to a maximum length of 40m. Description -2
marks
Page15
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Ans: 1. Processing Power: Selection of processor is based on the amount of processing Any 8 Each
power to get the job done and also on the basis of register width required. 1/2Marks
2. Throughput or Performance : the execution time or throughput of the system.
Instruction execution time in the system measures performance. Smaller
execution time means higher performance. For eg. in mobile phone, voice
Page16
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
signals are processed between antenna and speaker in 0.1s shows phone
performance. The system may need to handle a lot of data in a short time.
3. Response: The system has to react to the changing events quickly.
4. Memory: Hardware design must make the best estimate of the memory
requirement and must make the provision for expansion.
5. Power consumption: Systems generally work on battery and design of both
software and hardware must take care of power saving techniques.
6. Number of units: The number of units expected to be produced and sold will
dictate the trade-off between production cost and development cost.
7. Expected life-time: Design decisions like selection of components to system
development cost will depend upon on how long the system is expected to run.
8. Program Installation: Installation of software on to the embedded system needs
special development tools.
9. Testability and Debug ability: Setting up test conditions and equipment will be
difficult and determining what is wrong with the software will become a difficult
task without a keyboard and usual display.
10. Reliability: It is always required that the system designed must give the output
for which it is designed.
11. Power Dissipation: For battery operated system this is important feature.
Examples are mobile phone or digital camera where if power dissipation is small
battery needs to be recharge less frequently.
12. Unit cost: the monetary cost of manufacturing each copy of the system,
excluding NRE cost.
13. NRE cost (Non-Recurring Engineering cost): The monetary cost of designing
the system. Once the system is designed, any number of units can be
manufactured without incurring any additional design cost (hence the term “non-
recurring”).
14. Size: the physical space required by the system, often measured in bytes for
software, and gates or transistors for hardware.
15. Flexibility: the ability to change the functionality of the system without incurring
heavy NRE cost. Software is typically considered very flexible. Flexibility in
design enables, without significant engineering cost, development of different
versions or product or to develop advanced version later on. For example
software enhancement by adding extra functions.
16. Maintainability: Deals with support and maintenance to the end user or client in
case of technical issues and product failure. A more reliable system means with
less maintainability. As reliability of the system increases chances of failure and
non-functioning also reduces.
17. Time-to-market: The amount of time required to design and manufacture the
system to the point the system can be sold to customers. The main contributors
are design time, manufacturing time and testing time. There may be multiple
players in the embedded industry who develop products of the same category
(like mobile phones, portable media players etc.). If you come with new product
and time to market is high competitor may take advantage of it with their
product.
18. Time-to-prototype: The amount of time to build a working version of the system,
which may be bigger or more expensive than the final system implementation,
Page17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
but can be used to verify the system’s usefulness and correctness and to refine
the system's functionality. If the prototype is developed faster, the actual
estimated development time can be bought down.
19. Correctness: our confidence that we have implemented the system’s
functionality correctly. We can check the functionality throughout the process
of designing the system, and we can insert test circuitry to check that
manufacturing was correct.
20. Safety: the probability that the system will not cause harm. It deals with possible
damages that can happen to the operators, public and the environment due to
breakdown of embedded system, or due to the emission of radioactive or
hazardous materials from embedded products. Safety analysis is a must in
product engineering to evaluate the anticipated damages and determine best
course of action.
Ans: A deadlock is a situation where in two or more competing actions are each waiting for Explanation-
the other to finish, and thus neither ever does. In computer science, deadlock refers to a 2Marks
specific condition when two or more processes are each waiting for the other to release
a resource, or more than two processes are waiting for resources in a circular chain. Example-2
A deadlock, also called as deadly embrace, is a situation in which two threads are each Marks
unknowingly waiting for resource held by other.
Assume thread/process T1 has exclusive access to resource R1.
Thread/ process T2 has exclusive access to resource R2.
If T1 needs exclusive access to R2 and T2 needs exclusive access to R1,
Neither thread can continue.
They are deadlocked.
The simplest way to avoid a deadlock is for threads to:
Acquire all resources before proceeding
Acquire the resources in the same order
Release the resource in the revere order
Deadlock is the situation in which multiple concurrent threads of execution in a system
are blocked permanently because of resources requirement that can never be satisfied.
A typical real-time system has multiple types of resources and multiple concurrent
threads of execution contending for these resources. Each thread of execution can
acquire multiple resources of various types throughout its lifetime.
Potential for deadlock exist in a system in which the underlying RTOS permits resources
sharing among multiple threads of execution.
Following is a deadlock situation between two tasks.
Page18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
In this example, process 1 wants the resource 2 ex; scanner while holding the resource
1 ex: printer. Process 1 cannot proceed until both the printer and the scanner are in its
possession.
Process 2 wants the printer while holding the scanner. Process 2 cannot continue until it
has the printer and the scanner.
Because neither process 1 nor process 2 is willing to give up what it already has, the two
tasks are now deadlocked because neither can continue.
Program:
#include<reg51.h>
void delay(void);
sbit p=P3^5;
void main (void)
{
Page19
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
while (1)
{
p=~p;
delay();
}
}
void delay()
{
TMOD=0X01; //set timer 0 in mode 1 i.e. 16 bit number
TL0=0XA5H; //load TL register with LSB of count
TH0=0XFFH ; //Load TH register with MSB of count
TR0 =1 ; //Start timer 0
While(TF0= = 0); //wait until timer rolls over
TR0=0; //Stop timer 0
TF0=0; //Clear timer flag 0
}
b) Draw labelled interfacing diagram of stepper motor with 8951. Write a ‘C’ 6 Marks
program to rotate it in counterclockwise direction.
Ans: Diagram-
3Marks
Program-
3Marks
OR
Page20
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page21
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
Page22
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
3 Marks
Explanation.
In-circuit emulator (ICE) is one of the oldest embedded debugging tools, and is still
unmatched in power and capability.
It is only tool that substitutes its own internal processor for the one in the target system
Using one of a number of hardware tricks, the emulator can monitor everything that
goes on in this on-board CPU , giving a complete visibility into the target code’s
operation.
The emulator is bridge between the target and workstation giving an interactive terminal
peering deeply into the target and a rich set of debugging resources.
ICE uses another circuit with a card that connect to target processor (circuit) through a
socket.
Page23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
OR
• An in-circuit emulator (ICE) is a hardware device used to debug the software of
an embedded system. It was historically in the form of bond-out processor which
has many internal signals brought out for the purpose of debugging. These
signals provided information about the state of the processor.
• An in-circuit emulator provides a window into the embedded system. The
programmer uses the emulator to load programs into the embedded system, run
them, step through them slowly, and view and change data used by the system's
software.
• More recently the term also covers JTAG based hardware debuggers which
provide equivalent access using on-chip debugging hardware with standard
production chips.
• ICE’s attach a terminal or PC to the embedded system. The terminal or PC
provides an interactive user interface for the programmer to investigate and
control the embedded system.
• In usage, an ICE provides the programmer with execution breakpoints, memory
display and monitoring, and input/output control
a) Distinguish between assembly language and C language with reference to: 4 Marks
(i) Ease of programming
(ii) Memory requirement
(iii) Coding time
(iv) Execution time
Page24
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
b) Draw pin diagram of DB9. connector, stating function of each pin. 4 Marks
Page25
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
c) Draw labelled interfacing diagram of 16 X 2 LCD with 8951 and state function of 4 Marks
RS and R/W pin.
Ans: Interfacing diagram of 16 X 2 LCD with 8951 labelled
interfacing
diagram-
2 Marks,
functions-
1 Mark each.
Function:-
RS: RS is used to make the selection between data and command register.
RS=0, command register is selected RS=1 data register is selected.
RW: -R/W gives you the choice between writing and reading.
R/W=1, reading is enabled.
R/W=0 ,writing is enabled
d) A key is connected at P3.2 and 8 LEDs are connected to P1 of 8951. Write a ‘C’ 4 Marks
program to display 0 to 255 in binary on LEDs, when a key is pressed.
Ans: (Asssuming that P3.2 =0, when the key is pressed) Program with
#include<reg51.h> correct logic –
sbit sw = P3^2; 4 Marks
void delay (unsigned int);
void main(void)
{
sw=1;
unsigned char i;
P1=0X00;
while(1)
{
if(sw==0)
{
for(i=0;i<=255;i++)
{
P1=i;
delay(100);
Page26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)
}
}
else
P1=0;
}
}
void delay (unsigned int i time)
{
unsigned int i,j:
for (i=0;i<itime;i++)
for(j=0;j<1275;j++);
}
e) Manipulate the following table for data types used in ‘C’ 4 Marks
language.
Sr. No. Data type Bit size Data range
1. Unsigned char ? ?
2. Signed int ? ?
3. Sbit ? ?
4. Sfr ? ?
Ans: Sr. No. Data type Bit size Data range 1 Mark each
Page27