Super 25 ES Q&A
Super 25 ES Q&A
2. State any two applications for following i) Small scale embedded system. ii) Medium
scale embedded system.
Ans: 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).
Application : Washing Machine , Digital Camera, Industrial Robots Home Security
System
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.
Application : Routers for networking, ATM
OR
o Processor power: The embedded systems are controlled by microcontrollers or
digital signal processor (DSP). It can handle one or many specific task which require
very powerful processor.
1. Memory: Hardware design must make the best estimate of the memory requirement
and must make the provision for expansion.
OR
o Memory: The program developed for the embedded systems are treated as firmware
and stored in ROM or flash memory chips.
2. Power consumption: Systems generally work on battery and design of both software
and hardware must take care of power saving techniques.
3. Operating system: The embedded operating system is needed in embedded system to
limit the function depending on the embedded device and may only run a single
application which is crucial to the devices operation. Due to this the operating system
must be reliable and able to run with tight constraints on memory, size, time and
processing power.
4. Reliability: It is always required that the system designed must give the output for
which it is designed.
OR
Reliability: The embedded system should be much reliable to achieve a better performance
for long duration of time during its complete life cycle.
5. Performance: The performance of the system measures by the execution time or
throughput the system.
6. Power Consumption
It is the amount of power consumed by the system, which may determine the lifetime
of a battery, or the cooling requirements of the IC, since more power means more
heat.
OR
Power consumption: This is a very important factor for all embedded system which are
powered by batteries. So the amount of power will be consumed by the system, which
decides the capacity or lifetime of battery.
1. NRE cost (nonrecurring engineering cost)
It is one-time 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 nonrecurring.
2. Unit cost
The monetary cost of manufacturing each copy of the system, excluding NRE cost.
Size
The physical space required by the system, often measured in bytes for software, and
gates or transistors for hardware.
4. Draw the block diagram of embedded system and explain with hardware component.
Ans:
Processor: The processor is the heart of embedded system. The selection of processor is
based on the
Processor: The processor is the heart of embedded system. The selection of processor is
based on the following consideration
Instruction set
Maximum bits of operation on single arithmetic and logical operation
Speed
Algorithms processing and capability
Types of processor( microprocessor, microcontroller, digital signal processor,
application specific processor, general purpose processor)
Power source:
Internal power supply is must. Es require from power up to power down to start time task.
Also it can run continuously that is stay “On’ system consumes total power hence efficient
real time programming by using proper ‘wait’ and ‘stop’ instruction or disable some unit
which are not in use can save or limit power consumption.
Memory:
A system embeds either in the internal flash or ROM, PROM or in an external flash or ROM
or PROM of the microcontroller.
2. Write a C language program to transfer message “MSBTE” serially at 9600 band rate.
Assume crystal frequency 12 MHz.
Ans: #include <stdio.h>
#include <reg51.h>
void sertext (unsigned char) ;
void main( )
{ TMOD = 0x20 ;
SCON = 0x50 ;
TH1=0xFA ;
TR1 = 1 ;
sertext ('M') ;
sertext ('S') ;
sertext ('B') ;
sertext ('T') ;
sertext ('E') ;
while (1)
{
}
}
void sertext (unsigned char x)
{ SBUF = x ;
while (TI = = 0) ;
{
TI = 0 ;
}
}
3. Estimate hex data values of THO and TLO if 89C51 microcontroller operating at crystal
frequency of 11.0592 MHz and need to generate delay of 5 milliseconds.
Ans:
Let’s generate a square wave of 2mSec time period using an AT89C51 microcontroller with
timer0 in mode1 on the P1.0 pin of port1. Assume Xtal oscillator frequency of 11.0592 MHz.
4. Write C language program to generate square wave of 5 KHz on pin P1.5 of 89C51.
Ans:
I/P clock=11.0592 X 106 =11.0592MHz
1/12x11.0592Mhz= 921.6Khz
Tin =1.085μsec
For5 kHzsquarewave
Fout = 5KHz
Tout=1/5×103
Tout =200μsec
65536-92= 65444(10)=FFA5 H
Prog-
#include< reg51.h>
void delay(void);
sbit p=P3^5;
while (1)
$\ \ \ $ p=~p;
delay();
void delay()
5. Find the contents of port after execution of following code i) P2=0×74>>3; ii)
P3=0×040×68;
Ans: Ans:
i) P2=0×74>>3;
=
ii) P3=0×04!0×68;
=0x04=0000 0100,0x68=0110 1000
0000 0100
+
0110 1000
01101100
6C
P3=0×04!0×68=0X6C
6. Write a C program to toggle all bits of port 1 continuously with 60 ms delay in between.
Use timer 0 in mode 1 to generate the delay. The XTAL frequency is 11.0592 MHz.
Ans: #include <reg51.h>
void T0Delay(void);
void main(void){
while (1) {
P1=0x55;
T0Delay();
P1=0xAA;
T0Delay();
} }
void T0Delay()
{
TMOD=0x01;
TL0=0x00;
TH0=0x35;
TR0=1;
while (TF0==0);
TR0=0;
TF0=0;
Calculating delay:
= 51967 + 1 = 51968
7. Write 89C51 C program to mask the lower 4 bits of P2 and upper 4 bits of P0. Using
logical operator.
Ans: #include <stdio.h>
#include <reg51.h>
void main( )
{
P2 = P2 &0xF0;
P0=P0&0x0F;
while(1);
8. Write a C language program to operate port 0 and port 2 as output port and port 1 and
port3 as input port.
Ans:
#include<reg51.h>
void main (void )
{
unsigned char X,Y
P0=0X00; // P0 as output port
P2=0X00; // P2 as output port
P1=0XFF; //P1 as input port
P3=0XFF; // P3 as input port
while(1)
{
X= P1;
Y=P3;
P0=X;
P2=Y;
} //end of while
} //end of main
Data Terminal Ready – A positive voltage is applied to the data terminal ready (DTR) line,
a sign that the data terminal is prepared for the transmission of data
Data Set Ready – A positive voltage is applied to the data set ready (DSR) line, which
ensures the serial communications between a data terminal and a data set can be completed.
2. Compare between CAN and I2C protocols on the following points. i) ii) iii) iv) Data
Transfer rate Number of fields addressing bits Applications.
Ans:
Sr No Parameter I2C CAN
1 Data transfer rate Synchronous with 3 Asynchronous with
speeds 250kbps upto 1mbps
100kbps,400kbps and
3.4mbps
2 Number of fields 07 08
3 Addressing bits 7 bit or 10 bit address 11 bit
4 Application To interface devices like Elevator
watchdog,flash and controllers,medical
RAM memory,Real time instruments,production
clock and limit control system
microcontrollers
Universal Serial Bus is an industry standard used to define the cables, connectors and
communication protocols used in a bus for connection, communication and power supply
between computers and electronic devices.
➢ USB was designed to support data transfer and supply electric power between peripheral
devices such as mouse, keyboard, printer, portable media players, disk drive etc.
➢ A USB is a common computer port, which shorts for Universal Serial Bus and allows
communication between a computer and peripheral or other devices. It is the most common
interface used in today's computers, which can be used to connect printers, scanners,
keyboards, mice, game controllers, digital cameras, external hard drives and flash drives.
Multiple device connection: Upto 127 different devices can be connected on single USB
bus.
Transfer rate: The initial USB supported 12 MBps transfer rate where USB 2.0 supports
higher rate currently 60 MB/sec.
IrDA Architecture-
Protocol Architecture
The IrDA Data Protocol consists of a mandatory set of protocols and a set of optional
protocols.
Mandatory Protocols
1. IrPHY(Physical signaling layer)
2. IrLAP(Link Access Protocol)
3. IrLMP(Link Management Protocol)
4. IAS(Information Access Protocol)
Optional Protocols
IrLAP
• Responsible for performing device discovery and negotiation
• Provides a reliable transmission medium on which to build additional communications
• Based on HDLC protocol
• Responsible for preserving the physical connection
• Facilitates error detection, retransmission of lost or damaged packets & rudimentary flow
control
IrLMP
• Allows one or more IrDA services to run over a single IrLAP connection
4. State any four features of ZigBee. Draw and explain CAN bus with frame format.
Ans:
ADC808/809 Chip with 8 analogchannel. This means this kind of chip allows
to monitor 8 different transducers.
• ADC804 has only ONE analog input: Vin(+).
• ALE: Latch in the address
• Start : Start of conversion (same as WR in 804)
• OE: output enable (same as RD in 804)
• EOC: End of Conversion (same as INTR in 804)
2. Draw interfacing diagram of 4 × 4 matrix keyboard with 89C51.
Ans:
3. Write a ‘C’ language program to rotate stepper motor by 90° clockwise. Assume step
angle of 1.8° and 4 step sequences.
Ans: To rotate stepper motor for 900
Assuming step angle as 1.80
No. of steps = 90/1.8 = 50
The for loop should be executed 48/4=12 times and the pattern should be
given two times after the for loop
# include <reg51.h>
void Msdelay (unsigned int);
unsigned char x;
void main (void)
{
for(x=0;x<12;x++)
{
P1=0x09;
Msdelay (100)
P1=0x0C;
Msdelay(100)
P1=0x06;
Msdelay(100)
P1=0x03;
Msdelay(100)
}
P1=0x09;
Msdelay (100)
P1=0x0C;
Msdelay(100)
}
Void Msdelay(unsigned int k)
{
Unsigned int x,y;
For (x=0;x<k;x++)
For (y=0;y<1275;y++);
}
4. Draw interface diagram of 7 segment LED display to 89C51 and write a C program
to display 0-9 continuously.
Ans:
#include <reg51.h>
void msdelay(unsigned int);
unsigned Char disp_code[]=
{0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned char x;
void main(void)
{
while (1)
{
for (x = 0; x<= 9; x++) // loop to display 0-9
{
P2=disp_code[x];
msdelay(100);
}
}
}
void msdelay(unsigned int k)
{
unsigned int I,j;
for(i=0;i<k;i++)
{
for(j=0;j<1275;j++);
}
}
5. Sketch the diagram to interface DAC 0808 to port O of microcontroller 89C51 and
write a Embedded C language program to generate square wave to 50% duty cycle.
Ans:
6. Draw the interfacing diagram for temperature measurement using LM35, ADC 0808
with microcontroller 89C51.
Ans:
Temperature sensor are basically classified into two types
• Non Contact Temperature Sensors: These temperature sensors use
convection & radiation to monitor temperature
• Contact Temperature Sensors: Contact temperature sensors are then
further sub divided into three type
• Electro-Mechanical(Thermocouples).
• Resistive Resistance Temperature Detectors (RTD).
• Semiconductor based. (LM35, DS1820 etc).
LM35 is an integrated analog temperature sensor whose electrical output is
proportional to Degree Centigrade. LM35 Sensor does not require any
external calibration or trimming to provide typical accuracies. The LM35’s
low output impedance, linear output, and precise inherent calibration make
interfacing to readout or control circuitry especially easy. Prefix LM stands
for linear monolithic.
\
7. Draw labelled diagram to interface 16 × 2 LCD with 89C51. State function of pins i)
ii) iii) RS RIW EN
Ans:
Unit- V (12 marks)
Real Time Operating Systems (12 marks)
________________________________________________________
1.Explain watchdog timer and semaphore in detail.
Ans:
1.watchdog timer-
Most embedded systems need to be self-reliant. It’s not usually possible to wait for someone
to reboot them if the software hangs. Some embedded designs, such as space probes, are
simply not accessible to human operators. If their software ever hangs, such systems are
permanently disabled. In other cases, the speed with which a human operator might reset the
system would be too slow to meet the uptime requirements of the product.
A watchdog timer (WDT) is a piece of hardware that can be used to automatically detect
software anomalies and reset the processor if any occur. Generally speaking, a watchdog timer
is based on a counter that counts down from some initial value to zero. The embedded software
selects the counter’s initial value and periodically restarts it. If the counter ever reaches zero
before the software restarts it, the software is presumed to be malfunctioning and the
processor’s reset signal is asserted. The processor (and the embedded software it’s running)
will be restarted as if a human operator had cycled the power.
Figure 1 shows a typical arrangement. As shown, the watchdog timer is a chip external to the
processor. However, it could also be included within the same chip as the CPU. This is done in
many microcontrollers. In either case, the output from the watchdog timer is tied directly to the
processor’s reset signal.
2.Semaphore: a signal between tasks/interrupts that does not carry any additional data. The
meaning of the signal is implied by the semaphore object, so you need one semaphore for each
purpose. The most common type of semaphore is a binary semaphore, that triggers activation
of a task. The typical design pattern is that a task contains a main loop with an RTOS call to
“take” the semaphore. If the semaphore is not yet signaled, the RTOS blocks the task from
executing further until some task or interrupt routine “gives” the semaphore, i.e., signals it.
Sr OS RTOS
no
4 OS services can inject random delays into application OS services consumes only known and
software, may cause slow responsiveness of an expected amounts of time regardless the
application at unexpected time. number of services.
3. Describe inter task communication with reference to RTOS. Explain pre-emptive and
round robin scheduling algorithm in RTOS.
Ans:
Software is the basic building block of RTOS. Task is a simply subroutine. Task must
be able to communicate with one another to coordinate their activities or to share the
data.
Kernel object is used for inter task communication. Kernel objects uses message
queue, mail box and pipes, Shared Memory, Signal Function and RPC a for inter task
communication.
Message queue:-
A message queue is a buffer like data structure, through which tasks and ISRs
communicate with each other by sending and receiving messages and synchronize
with data.
It temporarily stores the message from a sender until the intended receiver is ready to
read them.
A message queue has queue control block, queue name, unique ID, 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.
Preemptive scheduling :-
Preemptive scheduling ensures that every task will get CPU time for execution . The
allotment of CPU time depends on the preemptive scheduling algorithm.
It allows a process to be interrupted in the middle of its execution, taking the CPU
away and allocating it to another process. The scheduling algorithm has high
overhead. System is costly and complex in design.
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
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.
4. Sketch architecture of RTOS and explain function of kernel and device drivers. List
out characteristics of RTOS
Ans:
An operating system generally consists of two ports: kernel space and user space.
RTOS kernel acts as an observation layer between the hardware and the applications.
Kernel is the smallest and central component of an operating system. Its services
include managing memory and devices and to provide an interface for software
applications to use the resources.
Six types of common services provided by the kernel are shown below in the figure:
_________________***_______________