0% found this document useful (0 votes)
26 views28 pages

MES Manual R-19

Neuromuscular electrical stimulation (NMES) of paralyzed muscles can be used to restore or replace motor function in individuals who have upper motor neuron damage from causes such as stroke or spinal cord injury (SCI). In some conditions, such as stroke or incomplete SCI, NMES may be part of a therapy regimen that helps restore volitional movement and function. In other conditions, such as severe stroke or complete SCI, permanent NMES applications are needed to replace the lost neuromuscular fu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views28 pages

MES Manual R-19

Neuromuscular electrical stimulation (NMES) of paralyzed muscles can be used to restore or replace motor function in individuals who have upper motor neuron damage from causes such as stroke or spinal cord injury (SCI). In some conditions, such as stroke or incomplete SCI, NMES may be part of a therapy regimen that helps restore volitional movement and function. In other conditions, such as severe stroke or complete SCI, permanent NMES applications are needed to replace the lost neuromuscular fu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 28

MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

DEPARTMENT OF BIOMEDICAL ENGINEERING

Laboratory Manual
for the subject

Course name: Microcontrollers and Embedded Systems Lab

(Subject Code: BML503)

T.E. Semester-V (CBCGS- R-19)

Name of the student…………………………………

UID……………….………Exam Seat No………………

Academic Year……………………………………………

BML503 Microcontrollers and Embedded Systems Lab 1


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

CONTENT

Sr. No. TOPIC PAGE NO.


1. Vision and Mission of college and department I
2. Examination Scheme and University Syllabus II
3. Course Objectives III
4. PSO & PO IV
5. CO & PO Mapping and CO & PSO Mapping VI
6. List of Experiments VII

BML503 Microcontrollers and Embedded Systems Lab 2


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Vision:

To become one of the outstanding Engineering Institutes in India by providing a conductive


and vibrant environment to achieve excellence in the field of Technology.

Mission:

To empower the aspiring professional students to be prudent enough to explore the world of
technology and mould them to be proficient to reach the pinnacle of success in the competitive
global economy.

Department of Biomedical Engineering

Vision:

To evolve into a center of excellence in Biomedical Engineering, modeling professionals


having inquisitive, innovative and creative minds with sound practical skills who can strive for
the betterment of mankind.

Mission:

To impart state-of-the-art knowledge to students in Biomedical Engineering and to inculcate


in them a high degree of social consciousness and a sense of human values, thereby enabling
them to face challenges with courage and conviction.

BML503 Microcontrollers and Embedded Systems Lab 3


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Course
Course Name Teaching scheme Credit assigned
Code
BML503 Microcontrollers Theory Pract. Tut. Theory Pract. Tut. Total
and Embedded
Systems Lab -- 02 -- -- 01 -- 01
(Abbreviated as
MES Lab)

Examination Scheme
Theory
Course Term Pract.
Course Name End Duration Total
Code Internal Assessment work / Oral
sem (hrs)
Test 1 Test 2 Avg.
BML503 Microcontrollers
and Embedded
Systems Lab -- -- -- -- -- 25 25 50
(Abbreviated as
MES Lab)

Course Code Course Name Credits


Microcontrollers and Embedded Systems Lab
BML503 01
(Abbreviated as MES Lab)
 Give the students skills in both simulation and practical implementation
of the basic building blocks of 8051 microcontroller-based applications
including timers/counters, PWM generation, I/O techniques and
Course Objectives
requirements, DC motors, stepper motors, keyboard, display device and
serial communications
 Give students skills in 8051 microcontroller programming.

Course Outcomes Learner will be able to:


CO1-Design different programs using C compilers for 8051 Controller
CO2- Design and develop 8051embedded C programs for timer-based
applications
CO3- Design and develop 8051embedded C programs for control of DC
motors and stepper motors
CO4- Design and develop 8051embedded C programs for interfacing
keyboard and display device
C05- Design and development using 8051

BML503 Microcontrollers and Embedded Systems Lab 4


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

BML503 Microcontrollers and Embedded Systems Lab 5


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Program Specific Outcomes (PSOs)

To impart technical knowledge and competency skills to perform in various areas


PSO1 like sales & marketing, product engineering, research-development, hospital
administration, regulatory affairs and also to venture into entrepreneurship.
Develop proficiency in various soft skills and bring awareness about social
PSO2 obligations and professional ethics to pursue professional career in a healthcare
industry.
Motivate to pursue research and specialization in a plethora of domains in the
field of Biomedical Engineering covering disciplines such as, Medical
PSO3 Instrumentation, Neuroscience, Computational Engineering, Robotics
Engineering, Medical Signal and Image processing, Rehabilitation Engineering,
VLSI, Nanotechnology and Biosensors, etc.

Program Outcomes (PO)

Engineering Graduates will be able to:

PO1) Engineering Knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals, and an engineering specialization to the solution of complex engineering
problems.

PO2) Problem Analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences, and engineering sciences.

PO3) Design/development of solutions: Design solutions for complex engineering problems


and design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.

PO4) Conduct investigations of complex problems: Use research-based knowledge and


research methods including design of experiments, analysis and interpretation of data, and
synthesis of the information to provide valid conclusions.

BML503 Microcontrollers and Embedded Systems Lab 6


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

PO5) Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex engineering
activities with an understanding of the limitations.

PO6) The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.

PO7) Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need
for sustainable development.

PO8) Ethics: Apply ethical principles and commit to professional ethics and responsibilities
and norms of the engineering practice.

PO9) Individual and team work: Function effectively as an individual, and as a member or
leader in diverse teams, and in multidisciplinary settings.

PO10) Communication: Communicate effectively on complex engineering activities with


the engineering community and with society at large, such as, being able to comprehend
and write effective reports and design documentation, make effective presentations, and
give and receive clear instructions.

PO11) Project management and finance: Demonstrate knowledge and understanding of


the engineering and management principles and apply these to one’s own work, as a
member and leader in a team, to manage projects and in multidisciplinary environments.

PO12) Life-long learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological
change.

BML503 Microcontrollers and Embedded Systems Lab 7


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

CO & PO Mapping: BML503 Microcontrollers and Embedded Systems Lab

Program Outcomes (PO)


Name of CO
PO PO PO PO PO PO PO PO PO PO PO PO Map
the course code
1 2 3 4 5 6 7 8 9 10 11 12
1

2
Microcon-
trollers and 3
Embedded 4
Systems
5

CO & PSO Mapping: BML503 Microcontrollers and Embedded Systems Lab

CO Code PSO1 PSO2 PSO3 MAP

Microcontrollers
and Embedded
Systems

BML503 Microcontrollers and Embedded Systems Lab 8


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

List of Experiments

Sr.
Name of Experiment CO PO PSO Page No.
No
Introduction to 8051
1 microcontroller and Keil
software.
To simulate simple ASM
2 programs based on data transfer,
arithmetic and logical
instructions.

3 To simulate ASM programs


using branching instructions.

4 To simulate timer program of


8051 using Keil software.

5 To simulate Embedded ‘C’


codes using Keil software.

6 To simulate Embedded ‘C’


codes using Proteus software.
To simulate interfacing of 16X2
7 LCD with 8051 microcontroller
using Proteus software.

8 Hardware implementation of any


one application.

Lab Incharge

BML503 Microcontrollers and Embedded Systems Lab 9


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Date:
Experiment No. 1
AIM: Introduction to 8051 and the Keil software.
SOFTWARE: Keil software
THEORY:
Draw and explain architectural block diagram and pin diagram of 8051 microcontroller.
PROCEDURE:
Write steps for simulating assembly language programs using Keil software.
PROGRAMMING ASSIGNMENT:

1. Write assembly program to exchange 2 values stored in the registers R 5 and R6. Select
register bank 1.
2. Write assembly program to find one’s compliment of a given no.
3. Write assembly program to find two’s compliment of a given no.
4. Write a program to copy the value 55H into internal RAM memory locations 40 to 45H
using direct addressing mode.
VIVA QUESTIONS:
1. Write salient features of 8051.
2. Explain role of PC
3. Explain the use of stack and SP.
4. Explain the importance of DPTR.
5. Why data pointer is 16 bit wide and stack pointer is 8 bit wide?
6. Why 11.592 MHz frequency is recommended with IC 8051?
7. Explain machine cycle and instruction cycle.
8. Explain the concept of dual port.
9. Explain opcode and operand.
10. List the types of data supported by 8051.

Date: Grade: Faculty Incharge

BML503 Microcontrollers and Embedded Systems Lab 10


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Date:
Experiment No. 2
AIM: To simulate simple ASM programmes based on data transfer, arithmetic and logical
instructions.
SOFTWARE: Keil software
THEORY:
In data transfer instructions data stored at source address is moved (actually copied) to
a destination address.

BML503 Microcontrollers and Embedded Systems Lab 11


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

BML503 Microcontrollers and Embedded Systems Lab 12


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

BML503 Microcontrollers and Embedded Systems Lab 13


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

PROGRAMMING ASSIGNMENT:

1. Write a program to copy the value 55H into internal RAM memory locations from 40 to
45H using register indirect addressing mode.
2. Write a program to transfer the contents of internal memory location starting from 21H
to 30 H to the internal ML starting from 51 H to 60 H.

3. AND the contents of external RAM location 9500h and 9501h. Store the result at
external RAM location 9502h.

4. Multiply the contents, stored at ML 20 H and 30H

VIVA QUESTIONS:

1. Load Port 1 with an 8-bit hexadecimal no and display it on Port3.


2. Transfer the content of R0 to Internal RAM location 30h to 33h.
3. Transfer the content of R7 to external RAM location 3000h.
4. Store 40H and 50H in external RAM locations 9500h and 9501h respectively.
5. State the role of register B.
6. In the 8051, which register bank conflicts with the stack?
7. What is the difference between MOV, MOVC and MOVX?
8. Which registers can be used for data transfer instructions?
9. Explain DA A with example.
10. Differentiate between MOV A, #22H and MOV A,22 H instructions.

Date: Grade: Faculty Incharge

BML503 Microcontrollers and Embedded Systems Lab 14


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Date:
Experiment No. 3
AIM: To simulate ASM programs using branching instructions.

THEORY: Branching group of instructions cover jumps and calls. These instructions are
decision-making instructions and program flow can be altered by examining certain conditions.
Following types of decision opcodes: jump on bit conditions, compare bytes and jump if not
equal, decrement byte and jump if zero, jump unconditionally, calla subroutine, return from a
subroutine.
In conventional instructions of some microprocessors, jump address is specified in operand but
8051 uses three different types of specifying jump address to save program memory, avoiding
unnecessary bytes in case of jump within short range.
Jump or call instructions may have one of three ranges:
i) A relative range of +127d to-128d bytes from the instruction following jump or call
instruction.
ii) An absolute range on the same 2k byte page as the instruction following jump or call,
or
iii) A long range of any address from 0000h to FFFFh, anywhere in program memory.

Relative Range:

Jumps by using relative range replace the program counter contents with a new address that is
greater than the address of the instruction following the jump by 127d or less than the address
of the instruction following jump by 128 d. Here the address given is relative. The address
following the jump is used to calculate the relative jump because of the action of PC. The PC is
incremented to point next instruction before the current instruction is executed.
Relative jump has two advantages. First, only one byte of data need be specified as address,
either in positive format for jumps ahead in the program or in two’s complement negative
format for jumps behind. Second advantage is that program written by using relative jumps can
be located anywhere in the program address space without reassembling the code to generate
absolute address.
The only disadvantage is that all the addressed jumps be within range of +127d or –128d bytes.
Short absolute range: all the program memory address space can be divided into a series of 2k
pages, giving a total of 32d(20h) pages for range 0000h to FFFFh. As an example, page 00
contains address range 0000h to 07FFh. For page 09 address range is 4800h to 4FFF. In
general, to find a range of any page (0 to 32d or 00h to 20 h) following method can be applied.
For page 10(0Ah) 10 x 8 = 80d =50 h
start address = 5000h
end address = 5000h + 07FFh(2k) = 57FFh
For page 29 (1Dh) 29 x 8 = 232d = E8h
start address = E800h
end address = E800h + 07FFh(2k) = EFFFh.

Inspection of the address range of each page number reveals that the upper 5 bits hold the
page number and lower 11 bit hold the address within the page. Eight different opcodes
are provided for one instruction using short absolute range address. Appropriate code for
instructions should be used for these instructions. It offers advantage of allowing jump or

BML503 Microcontrollers and Embedded Systems Lab 15


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

calls over longer programming distances than does relative addressing.


Long absolute range:
Long-range addressing areas use entire program space 0000H to FFFFH. Absolute
address is provided in operand part of instruction.

BML503 Microcontrollers and Embedded Systems Lab 16


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

BML503 Microcontrollers and Embedded Systems Lab 17


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

PROGRAMMING ASSIGNMENT:

1. Fill the external RAM memory location 9500h to 9600h with a number 20h.
2. Multiply data on external RAM location 9500h and 9501h. store result in same
locations ie. at 9500h store low byte and at 9501 store high byte.
3. Count the number of bytes in external RAM locations 9500h to 9504h that are greater
than 01H and less than 05H. Use register R0 to hold the count.

VIVA QUESTIONS

1. If the lower nibble of any number placed in A is larger than Upper nibble, set the C
flag to 1, otherwise clear it.
2. Count the number of 1‟s in R1 and put count in R0.
3. W.A. P. to find largest no. among data stored from RAM location 30 H 3F H.
4. Differentiate between SJMP, AJMP, and LJMP instructions.\
5. What is the advantage of using SJMP over LJMP?
6. Explain instruction SJMP
7. Explain instruction DJNZ R3, BACK.
8. In JZ NEXT, which register’s content is checked if it is zero?
9. Explain CALL instruction and the role of the stack.
10. Write instructions to toggle both bits of P1.7 and P1.0 continuously.

References: 8051 Microcontroller by Mohmd. Ali Mazidi

Date: Grade: Faculty Incharge:

BML503 Microcontrollers and Embedded Systems Lab 18


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Date
EXPERIMENT No. 4
AIM: Programming using 8051 Timer

THEORY:
The 8051 comes equipped with two timers, both of which may be controlled, set, read, and
configured individually. The 8051 timers have three general functions: 1) Keeping time and/or
calculating the amount of time between events, 2) Counting the events themselves, or 3)
Generating baud rates for the serial port.

Timer SFRs
As mentioned before, the 8051 has two timers which each function essentially the same way.
One timer is TIMER0 and the other is TIMER1. The two timers share two SFRs (TMOD and
TCON) which control the timers, and each timer also has two SFRs dedicated solely to itself
(TH0/TL0 and TH1/TL1).

SFR Name Description SFR Address

TH0 Timer 0 High Byte 8Ch

TL0 Timer 0 Low Byte 8Ah

TH1 Timer 1 High Byte 8Dh

TL1 Timer 1 Low Byte 8Bh

TCON Timer Control 88h

TMOD Timer Mode 89h

TMOD (89h) SFR

Bit Name Explanation of Function Timer

When this bit is set the timer will only run when INT1 (P3.3)

BML503 Microcontrollers and Embedded Systems Lab 19


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

7 GATE1 is high. When this bit is clear the timer will run regardless of 1
the state of INT1.

When this bit is set the timer will count events on T1 (P3.5).
6 C/T1 When this bit is clear the timer will be incremented every 1
machine cycle.

5 T1M1 Timer mode bit (see below) 1

4 T1M0 Timer mode bit (see below) 1

When this bit is set the timer will only run when INT0 (P3.2)
3 GATE0 is high. When this bit is clear the timer will run regardless of 0
the state of INT0.

When this bit is set the timer will count events on T0 (P3.4).
2 C/T0 When this bit is clear the timer will be incremented every 0
machine cycle.

1 T0M1 Timer mode bit (see below) 0

0 T0M0 Timer mode bit (see below) 0

The TCON SFR


Finally, theres one more SFR that controls the two timers and provides valuable
information about them. The TCON SFR has the following structure

Bit
Bit Name Address Explanation of Function Timer

7 TF1 8Fh Timer 1 Overflow. This bit is set by the microcontroller 1


when Timer 1 overflows.

BML503 Microcontrollers and Embedded Systems Lab 20


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

6 TR1 8Eh Timer 1 Run. When this bit is set Timer 1 is turned on. 1
When this bit is clear Timer 1 is off.

5 TF0 8Dh Timer 0 Overflow. This bit is set by the microcontroller 0


when Timer 0 overflows.

4 TR0 8Ch Timer 0 Run. When this bit is set Timer 0 is turned on. 0
When this bit is clear Timer 0 is off.

PROGRAMMING ASSIGNMENT:

1. What is the lowest frequency that can be generated using Mode 1 if the crystal
frequency is 11.0592 MHz? Show your calculation.
2. W.A.P. to generate square wave with 50 Hz frequency on P1.0. Assume crystal
frequency of 11.0592 MHz.

VIVA QUESTIONS:

1. What is counted by microcontroller when it is used as timer and counter?


2. What is the status of GATE and INPUT?
3. What is the maximum count in mode 0 and mode 1?
4. Why mode 2 is called auto reload?
5. In mode 3 which timer is not used?
6. Differentiate asynchronous and synchronous method of data transfer.
7. Differentiate simplex, half duplex and full duplex communication.
8. Define Baud rate and state relationship between crystal frequency and baud rate.
9. Differentiate interrupt and polling.
10. To bypass the interrupt vector table, which instruction is used?

References: 8051 Microcontroller by Mohmd. Ali Mazidi

BML503 Microcontrollers and Embedded Systems Lab 21


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Date: Grade: Faculty Incharge:

BML503 Microcontrollers and Embedded Systems Lab 22


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Date:
EXPERIMENT No. 5
AIM: To simulate simple Embedded ‘C’ codes using Keil software.

SOFTWARE: Keil software

Theory:

Procedure-

Write procedure for simulating in Keil software.

PROGRAMMING ASSIGNMENT
1. Write 8051 ‘C’ program to toggle all the bits of P1 continuously.
2. Write 8051 ‘C’ program to toggle alternate bits of P1 continuously.
3. Write 8051 ‘C’ program to toggle bit D0 of port P1, 10 times.

VIVA QUESTIONS:
1. The signed char is a data types that takes value –
2. Which are the ‘C’ data types used for 8051?
3. What are the contents of P1 after the following "C" code is executed?
#include <reg51.h>
void main (void)
{
P1= 0x37 & 0xCA;
}

4. Find the contents of P2 after the following C code is executed.


# include<reg51.h>
void main(void)
{
P2=0x11;
P2= P2 | 0xFF;
}
5. If the current count is E1H and the next count is E3H, what is the time taken by the 8051 Timer
for single upcounting operation if the crystal frequency is 11.0592 MHz?

References: 8051 Microcontroller by Mohmd. Ali Mazidi

Date: Grade: Faculty Incharge:

BML503 Microcontrollers and Embedded Systems Lab 23


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Date:
EXPERIMENT No. 6
AIM: To simulate Embedded ‘C’ codes using Proteus software.

SOFTWARE: Proteus software

Theory:

Procedure-

PROGRAMMING ASSIGNMENT:

1. Using Proteus software, interface all LEDs with port P2. Switch on and switch
off alternatively.
2. Using Proteus software, interface all LEDs with port P2. Make 4 LEDs on and 4
LEDs off switch off alternatively.

VIVA QUESTIONS:
1. What is the step size in ADC?
2. What is the conversion time?
3. In ADC how end of conversion is indicated?
4. State the advantage of LCD display over LED display.
5. State the role of ULN 2003 current driver in stepper motor interfacing.
6. If an 8*8 matrix of keys needs to be connected to 8051 microcontrollers, how many
ports of 8051 will be used?
7. The rows and columns of a 4*4 matrix keyboard are connected respectively to the
lower half of P1(output port) and the lower half of P2(input port) of 8051
Microcontroller. If no key has been pressed, reading P2 will yield which of the
following binary values in its lower half?
8. How many discrete voltage (or current) levels of outputDAC0808 provides?
9. Ideally, we connect the output pin of the DAC0808 to………………
10. How many address lines are required for accessing the data in a 1,024 bytes RAM
memory chip, while data is organized as bytes?

References: 8051 Microcontroller by Mohmd. Ali Mazidi

Date: Grade: Faculty Incharge:

BML503 Microcontrollers and Embedded Systems Lab 24


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Date:
Experiment – 7
Aim: Interface 16X2 LCD with 8051 Microcontroller.

Theory:

LCD pin descriptions:

The LCD discussed in this section has 14 pins. The function of each pin is given in table.

Pin Symbol I/O Description


1 GND - Ground
2 Vcc - +5V power supply
3 VEE - Contrast control
4 RS I command/data register selection
5 R/W I write/read selection
6 E I/O Enable
7 DB0 I/O The 8-bit data bus
8 DB1 I/O The 8-bit data bus
9 DB2 I/O The 8-bit data bus
10 DB3 I/O The 8-bit data bus
11 DB4 I/O The 8-bit data bus
12 DB5 I/O The 8-bit data bus
13 DB6 I/O The 8-bit data bus
14 DB7 I/O The 8-bit data bus

Vcc, Vss, and VEE


While Vcc and Vss provide +5V and ground, respectively, VEE is used for controlling
LCD contrast.

RS - register select:
There are two very important registers inside the LCD. The RS pin is used for their
selection as follows. If RS = 0, the instruction command code register is selected, allowing
the user to send a command such as clear display, cursor at home, etc. If RS = 1 the data
register is selected, allowing the user to send data to be displayed on the LCD.

R/W - read/write:
R/W input allows the user to write information to the LCD or read information from
it. R/W = 1 when reading; R/W =0 when writing.

E - enable:
The enable pin is used by the LCD to latch information presented to its data pins. When
data is supplied to data pins, a high to low pulse must be applied to this pin in order for the
LCD to latch in the data present at the data pins. This pulse must be minimum 450 ns wide.

BML503 Microcontrollers and Embedded Systems Lab 25


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

D0 – D7:
The 8-bit data pins, D0 – D7, are used to send information to the LCD or read
the contents of the LCD‟s internal registers.
To display letters and numbers, we send ASCII codes for the letters A – Z, a – z,
and numbers 0 – 9 to these pins while making RS = 1.
There are also instructions command codes that can be sent to the LCD to clear
the display or force the cursor to the particular position
Code (hex) Command to LCD Instruction Register
1 Clear display screen
2 Return home
4 Shift cursor to left
5 Shift display right
6 Shift cursor to right
7 Shift display left
8 Display off, Cursor off
A Display off, Cursor on
C Display on, cursor off
E Display on, cursor blinking
F Display on, cursor blinking
10 Shift cursor position to left
14 Shift cursor position to right
18 Shift the entire display to the left
1C Shift the entire display to the right
80 Force cursor to beginning of 1st line
C0 Force cursor to beginning of 2nd line
38 2 lines and 5x7 matrix

Schematic Diagram of LCD interfacing with 8051

EXERCISE

BML503 Microcontrollers and Embedded Systems Lab 26


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

W.A. P. to display “ Hello” to LCD

EXERCISE: Write a program to display “HELLO”.

QUESTIONS:

1.Simulate the above program in Proteus software.

2. Give LCD interfacing diagram with 8051.

3 Give LCD timing waveforms for read.

4 Give LCD timing waveforms for write.

5. Which are the two registers in the LCD module?

6. Which are the control pins of the LCD? What are their functions?

7. To display letters and numbers, we send data in ……………. Code

8. How does LCD distinguish between data and command?

9. Give the state of RS, E and R/W when sending data character ‘Z’ to the LCD.

10. Give the command codes for line1, first character, and line 2, first character.

Date: Grade: Faculty Incharge:

BML503 Microcontrollers and Embedded Systems Lab 27


MAHATMA GANDHI MISSION’S COLLEGE OF ENGINEERING & TECHNOLOGY

Affiliated to University of Mumbai & Approved by AICTE, New Delhi

Date:
EXPERIMENT No- 08
AIM: To implement any one hardware circuit from the following.

THEORY:
Include the appropriate circuit explanation and corresponding algorithm. Also include the
program.

PROCEDURE:
Enlist the steps to be carried out to execute it.

References: 8051 Microcontroller by Mohmd. Ali Mazidi

Date: Grade: Faculty Incharge:

BML503 Microcontrollers and Embedded Systems Lab 28

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy