Assignment-2 B.Tech-CSE-ALL Subject: Microprocessor and Embedded System Date of Submission: 30 April 2020
Assignment-2 B.Tech-CSE-ALL Subject: Microprocessor and Embedded System Date of Submission: 30 April 2020
B.Tech- CSE-ALL
Subject: Microprocessor and Embedded System
Date of Submission: 30th April 2020
Q.1 What are the different types of semaphores used in RTOS? Explain with examples.
Q.2 The interfacing of a hex keypad to 8051/8085 microcontroller/ microprocessor is very essential while
designing embedded system projects which requires character or numeric input or both. For examples
projects like digital code lock, numeric calculator etc.
Before going to the interfacing in detail, let’s have a look at the hex keypad. Hex key pad is essentially
a collection of 16 keys arranged in the form of a 4 × 4 matrix. Hex keypad usually have keys
representing numerics 0 to 9 and characters A to F. The simplified diagram of a typical hex key pad is
shown in the figure below. The hex keypad has 8 communication lines namely R1, R2, R3, R4, C1, C2,
C3 and C4. R1 to R4 represents the four rows and C1 to C4 represents the four columns. When a
particular key is pressed the corresponding row and column to which the terminals of the key are
connected gets shorted. For example if key 1 is pressed row R1 and column C1 gets shorted and so on.
The program identifies which key is pressed by a method known as column scanning. In this method a
particular row is kept low (other rows are kept high) and the columns are checked for low. If a
particular column is found low then that means that the key connected between that column and the
corresponding row (the row that is kept low) is been pressed. For example if row R1 is initially kept
low and column C1 is found low during scanning, that means key 1 is pressed.
(a) Based on the discussed case, develop the algorithm of keypad interfacing.
(b) WAP to display all the numerical values and characters. Use any microprocessor and
microcontroller
Q.3 Programming a 7-Segment display is so easy as to program a LED array but here pattern should be
generate in a manner so as it appears as a meaningful character and with cascaded mode we also need
to send "clear" (0) or "set bit" (1) signal on respected pins of port two in order to enable or disable
respected 7-Segment display. The signals on Port zero which can generate meaningful characters on 7-
Segment display are listed in fig. 3(a) below.
Fig 2(a) Pattern of 7 segments
(a) Develop the Embedded ‘C’ code or assembly program to support output shown in fig. 1(b) with
interface the 8051 microcontroller using one segment.
(b) Draw and discuss the interface diagram with the four segments and method of displaying the
output.
(c) Replace the Seven Segment with 16 x 2 LCD. Draw the interface diagram and write embedded
‘C’code to display the same data on LCD.
Q.4 Water level indicator is used in tanks to indicate the level of liquids and alert us when the tank is full.
So by the circuit we can monitor the various levels of the tank and can avoid spillage of water and also
we can configure our supplies according to the various levels of tank as shown in figure 3. Such
module or circuit can be installed in big buildings where manual monitor of tanks is difficult and its
indicator can be placed at some centralized place.
Fig.3
Write assembly programs to display the conditions of tank on LCD using either 8085
microprocessor or 8051 microcontroller on LCD display. It is optional to use the interface of 8255 PPI
with microprocessor/ microcontroller. Assume any missed data.
(a) Vacant
(b) Quarter
(c) Half
(d) Full
Q.5 An ALU is a combinational logic circuit, meaning that its outputs will change asynchronously in
response to input changes. In normal operation, stable signals are applied to all of the ALU inputs and,
when enough time (known as the "propagation delay") has passed for the signals to propagate through
the ALU circuitry, the result of the ALU operation appears at the ALU outputs. The external circuitry
connected to the ALU is responsible for ensuring the stability of ALU input signals throughout the
operation, and for allowing sufficient time for the signals to propagate through the ALU before
sampling the ALU result. In general, external circuitry controls an ALU by applying signals to its
inputs. Typically, the external circuitry employs sequential logic to control the ALU operation, which
is paced by a clock signal of a sufficiently low frequency to ensure enough time for the ALU outputs to
settle under worst-case conditions. For example, a CPU begins an ALU addition operation by routing
operands from their sources (which are usually registers) to the ALU's operand inputs, while
the control unit simultaneously applies a value to the ALU's opcode input, configuring it to perform
addition. At the same time, the CPU also routes the ALU result output to a destination register that will
receive the sum. The ALU's input signals, which are held stable until the next clock, are allowed to
propagate through the ALU and to the destination register while the CPU waits for the next clock.
When the next clock arrives, the destination register stores the ALU result and, since the ALU
operation has completed, the ALU inputs may be set up for the next ALU operation.
Write the Embedded ‘C’ or assembly language program for 8051 microcontroller can perform at
least 5 operations of ALU.