SlideShare a Scribd company logo
1 of 109
Download to read offline
Applications of 8051 Microcontroller
Dr. Nilesh Bhaskarrao Bahadure
https://www.sites.google.com/site/nileshbbahadure/home
July 25, 2021
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 1 / 109
Overview I
1 Light Emitting Diodes
Introduction to LED
Example - 1: Single LED
Example - 2: Multiple LED
Example - 3: Multiple LED
2 Seven Segment LED
Introduction to Seven Segment LED
Example - 1: Single 7 - Segment to display number 3
Example - 2: Single 7 - Segment for display 0 - 9
Example - 3: Single 7 - Segment for display 0 - 9 using 7447 Decoder
Example - 4: Two 7 - Segment for display 31
3 LCD Interfacing
LCD Introduction
LCD Commands
Example - 1: Display NB Bahadure on LCD
4 Stepper Motor Interfacing
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 2 / 109
Overview II
Introduction to Stepper Motor
Stepper motor types
Step Sequence
Step Angle
Example - 1: Rotate Stepper Motor Clockwise
Example - 2: Rotate Stepper Motor Clockwise in Half Step Sequence
Example - 3: Rotate Stepper Motor Clockwise - Counter Clockwise
based on Switch
5 Digital to Analog Converter
Introduction to DAC
Example - 1: Generate Sawtooth Waveform
Example - 2: Generate Reverse Sawtooth Waveform
Example - 3: Generate 200 Triangular Waveform
Example - 4: Generate Sine Waveform
6 ADC Interfacing
Introduction to ADC
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 3 / 109
Overview III
Example - 1: Interfacing ADC 0804 with 8051
7 Keyboard Interfacing
Introduction to Keyboard
Example - 1: Interfacing of 4 x 4 Matrix Keyboard with 8051
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 4 / 109
Light Emitting Diodes
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 5 / 109
Introduction to LED
Light emitting diodes, commonly called LEDs, are real unsung heroes in
the electronics world. They do dozens of different jobs and are found
in all kinds of devices. Among other things, they form numbers ondigi-
tal clocks, transmit information fromremote controls, light up watches and
tell you when your appliances are turned on. Collected together, they can
form images on ajumbo television screenorilluminate a traffic light. Alight-
emitting diode(LED) is a two-leadsemiconductorlight source that resembles
a basicPN-junctiondiode, except that an LED also emits light.When an
LEDโ€™s anode lead has a voltage that is more positive than its cathode lead
by at least the LEDโ€™s forward voltage drop, current flows.Electronsare able
to recombine withholeswithin the device, releasing energy in the form of-
photons. This effect is calledelectroluminescent, and the color of the light
(corresponding to the energy of the photon) is determined by the energy
bandof the semiconductor. An LED is often small in area, and integrated
optical components may be used to shape itsradiation pattern.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 6 / 109
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 7 / 109
To interface LEDโ€™s with microprocessor or Microcontroller based system, we
must consider the following
LEDโ€™s glow only when they are forward biased and
Their resistance is almost zero for all practical purpose.
It means that they must be interfaced with proper polarity and with a proper
value of resistance in series. This resistance is a current limiting resistor,
and its value is to be calculated as per the supplied voltage applied to the
LED and current limit of the LED.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 8 / 109
Example
Show the interfacing of LED with port pin P2.1 of Microcontroller 8051 and
write an assembly language program to blink LED continuously. Assume
that operating frequency of 8051 Microcontroller is 11.0592 MHz.
Solution
Hardware Arrangement:
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 9 / 109
Method - I
Assembly Language Program
ORG 0000h
LOOP: CLR P2.1
ACALL DELAY
SETB P2.1
ACALL DELAY
JMP LOOP
DELAY: MOV R3, #0FFH
REP: MOV R2, #0FFH
HERE: DJNZ R2, HERE
DJNZ R3, REP
RET
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 10 / 109
Method - II
Assembly Language Program
ORG 0000h
LOOP: CPL P2.1
ACALL DELAY
JMP LOOP
DELAY: MOV R3, #0FFH
REP: MOV R2, #0FFH
HERE: DJNZ R2, HERE
DJNZ R3, REP
RET
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 11 / 109
Example
Show the interfacing of 8 - LEDโ€™s using common anode arrangement with
port 2 pins of 8051 microcontroller. Write an assembly language program
to blink the LEDโ€™s continuously. Assume operating frequency of 8051 Mi-
crocontroller is 11.0592 MHz.
Solution
Hardware Arrangement:
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 12 / 109
Assembly Language Program
ORG 0000h
MOV A, #55h
LOOP: CPL A
MOV P2, A
ACALL DELAY
SETB P2.1
ACALL DELAY
JMP LOOP
DELAY: MOV R3, #0FFH
REP: MOV R2, #0FFH
HERE: DJNZ R2, HERE
DJNZ R3, REP
RET
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 13 / 109
Proteus Design
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 14 / 109
Example
Show the interfacing of LED with port pin P2.0 of Microcontroller 8051 and
write an assembly language program to ON the LED when the key K1 is
pressed and OFF the LED when key is pressed k2. Assume that operating
frequency of 8051 Microcontroller is 11.0592 MHz.
Solution
Hardware Arrangement:
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 15 / 109
Assembly Language Program
ORG 0000h
SETB P1.0 ; Set port pin P1.0 as input (key K1)
SETB P1.1 ; Set port pin P1.1 as input (key K2)
LOOP: MOV A, P1 ; Read key values
RRC A ; Rotate towards right to check key K1
JC KEY K2 ; If carry key K1 is not pressed go for key K2
CLR P2.0 ; if no carry key K1 is pressed ON the LED
ACALL DELAY
SJMP LOOP
KEY K2: RRC A ; Rotate towards right to check key K2
JC LOOP ; If carry read the keys again and repeat
SETB P2.0 ; If no carry key K2 is pressed OFF the LED
ACALL DELAY
SJMP LOOP
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 16 / 109
Assembly Language Program
DELAY: MOV R3, #0FFH
REP: MOV R2, #0FFH
HERE: DJNZ R2, HERE
DJNZ R3, REP
RET
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 17 / 109
Proteus Design
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 18 / 109
Seven Segment LED
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 19 / 109
Introduction to Seven Segment LED
The Light Emitting Diode (LED) finds its place in many applications in these
modern electronic fields. One of them is the Seven Segment Display. Seven-
segment displays contains the arrangement of the LEDโ€™s in โ€œEightโ€ (8)
passion, and a Dot (.) with a common electrode, lead (Anode or Cathode).
The purpose of arranging it in that passion is that we can make any number
out of that by switching ON and OFF the particular LEDโ€™s. Figure 1 shows
the block diagram of the Seven Segment LED arrangement.
Figure : Seven Segment Display
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 20 / 109
Introduction to Seven Segment LED...
7 segment displays are basically 7 LEDโ€™s. There are two types of 7 segment
displays common cathode and common anode.
(a) Common Cathode - where all the segment share the same cathode.
(b) Common Anode - where all the segment share the sane anode.
In common Anode in order to turn ON a segment the corresponding pin must
be set to 0 and to turn it OFF it is set to 1. Similarly in common cathode
in order to turn ON a segment the corresponding pin must be set to 1 and
to turn it OFF it is set to 0. As shown in the figure 2 in common anode
type, all the anodes of LEDโ€™s are connected common with the +5V power
supply and hence the name common anode 7 - segment LED. Similarly for
common cathode configuration, it shows that all the cathodes of LEDs are
connected common to the ground, and hence the name common cathode 7
- segment LED.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 21 / 109
Introduction to Seven Segment LED...
Figure : Seven Segment Display
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 22 / 109
There 2 methods of interfacing LED with the Microcontroller Intel 8051/
AT89C51.
(a) Using lookup table. This uses 7 output pins of Microcontroller
(b) Using 7447 decoder. This method uses 4 output pins of Microcontroller
The difference between the two main methods is simple and clear. In both
the cases, Microcontroller communicates with external world through its
ports. But, in the 1st case, we connect all the 8 pins of the port directly to
the LED and control the voltage through the ports manually to display the
desired number. But, in the second case, we send the BCD of the number
that we wanted to display to a middleware IC 7447, the BCD to LED code
converter, which by itself gives out the correspondent 7 segment codes to
the LED.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 23 / 109
Look - up table for Seven Segment LED
Hex
Code
seven segment conversion 7 - seg equivalent
dot g f e d c b a
0 1 1 0 0 0 0 0 0 C0H
1 1 1 1 1 1 0 0 1 F9H
2 1 0 1 0 0 1 0 0 A4H
3 1 0 1 1 0 0 0 0 B0H
4 1 0 0 1 1 0 0 1 99H
5 1 0 0 1 0 0 1 0 92H
6 1 0 0 0 0 0 1 0 82H
7 1 1 1 1 1 0 0 0 F8H
8 1 0 0 0 0 0 0 0 80H
9 1 0 0 1 1 0 0 0 98H
Table : 7 - segment display code for the common anode configuration
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 24 / 109
Look - up table for Seven Segment LED
Hex
Code
seven segment conversion 7 - seg equivalent
dot g f e d c b a
0 0 0 1 1 1 1 1 1 3FH
1 0 0 0 0 0 1 1 0 06H
2 0 1 0 1 1 0 1 1 5BH
3 0 1 0 0 1 1 1 1 4FH
4 0 1 1 0 0 1 1 0 66H
5 0 1 1 0 1 1 0 1 6DH
6 0 1 1 1 1 1 0 1 7DH
7 0 0 0 0 0 1 1 1 07H
8 0 1 1 1 1 1 1 1 7FH
9 0 1 1 0 0 1 1 1 67H
Table : 7 - segment display code for the common cathode configuration
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 25 / 109
Example
Show the interfacing of seven segment display device of common anode
type with 8051 Microcontroller and write an assembly language program
to display digit 3 continuously. Assume that operating frequency of 8051
Microcontroller is 11.0592 MHz.
Solution
Figure : Hardware arrangement
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 26 / 109
Assembly Language Program
using common anode
ORG 0000H
MOV P2, #0FFH ; OFF all the LEDโ€™s
LOOP: MOV P2, #0B0H ; display code for 3
ACALL DELAY
SJMP LOOP
DELAY: MOV R3, #0FFH
REP: MOV R2, #0FFH
HERE: DJNZ R2, HERE
DJNZ R3, REP
RET
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 27 / 109
Proteus Design
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 28 / 109
Example
Show the interfacing of seven segment display device common anode type
with 8051 Microcontroller and write an assembly language program to dis-
play digit 0 to 9 continuously. Assume that operating frequency of 8051
Microcontroller is 11.0592 MHz.
Solution
Figure : Hardware arrangement
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 29 / 109
Assembly Language Program
using common anode
ORG 0000h
REPEAT: MOV R2, #10
MOV DPTR, #MSG
LOOP: CLR A
MOVC A, @A+DPTR
MOV P2,A
ACALL DELAY
INC DPTR
DJNZ R2, LOOP
LJMP REPEAT
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 30 / 109
Assembly Language Program
DELAY: MOV R3, #0FFH
REP: MOV R4, #0FFH
MOV R5, #0FFH
HERE: DJNZ R5, HERE
HERE1: DJNZ R4, HERE1
DJNZ R3, REP
RET
MSG: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,98H
END
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 31 / 109
Example
Show the interfacing of seven segment display device of common anode type
using 7447 decoder with 8051 Microcontroller and write an assembly lan-
guage program to display digits 0 to 9 continuously. Assume that operating
frequency of 8051 Microcontroller is 11.0592 MHz.
Solution
Figure : Hardware arrangement
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 32 / 109
Assembly Language Program
ORG 0000h
AGAIN: MOV A, #00H ; Start form zero
UP: MOV P2, A ; Move to Port 2
ACALL DELAY
INC A
CJNE A, #0AH, UP ; send only from 0 to 9
SJMP AGAIN
DELAY: MOV R3, #0FFH
REP: MOV R4, #0FFH
MOV R5, #0FFH
HERE: DJNZ R5, HERE
HERE1: DJNZ R4, HERE1
DJNZ R3, REP
RET
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 33 / 109
Proteus Design
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 34 / 109
Example
Show the interfacing of two 7 - segment LED with Microcontroller 8051,
and write an assembly language program to display digit 31 continuously.
For the delay, assume that operating frequency of 8051 Microcontroller is
11.0592 MHz.
Solution
Figure : Interfacing of two 7 - segment LED in Common anode configuration with
8051 Microcontroller
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 35 / 109
Assembly Language Program
ORG 0000h
CLR P3.0
CLR P3.1
MOV P2, #0FFh ; Off All seven segment display
Loop: CLR P3.0
SETB P3.1
MOV P2, #0B0h
CALL delay
CLR P3.1
SETB P3.0
MOV P2, #0F9h
CALL delay
AJMP Loop
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 36 / 109
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 37 / 109
The most commonly used Character based LCDs are based on Hitachiโ€™s
HD44780 controller or other which are compatible with HD44580. In this
application, we will discuss about character based LCDs, their interfacing
with Microcontroller 8051
Figure : Character LCD type HD44780 pin diagram
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 38 / 109
Table : Pin description of character LCD type HD44780
Pin No. Name Description
1 VSS Power Supply (GND)
2 VCC Power Supply (+5V)
3 VEE Contrast adjust
4 RS Register Select
0 = To select command register
1 = To select Data register
5 R/W Read/Write
0 = Write to the LCD
1 = Read from the LCD
6 EN Enable Signal
7 D0 Data bus line D0 (LSB)
8 D1 Data bus line D1
9 D2 Data bus line D2
10 D3 Data bus line D3
11 D4 Data bus line D4
12 D5 Data bus line D5
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 39 / 109
LCD Commands
Only the instruction register (IR) and the data register (DR) of the LCD
can be controlled by the MCU. Before starting the internal operation of
the LCD, control information is temporarily stored into these registers to
allow interfacing with various MCUs, which operate at different speeds, or
various peripheral control devices. The internal operation of the LCD is
determined by signals sent from the MCU. These signals, which include
register selection signal (RS), read/write signal (R/W), and the data bus
(DB0 to DB7), make up the LCD instructions
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 40 / 109
LCD Commands...
Command code (Hex) Command to the LCD instruction register
01 Clear display screen
02 Return home
04 Decrement cursor (shift cursor to left)
06 Increment cursor (shift cursor to right)
05 Shift display right
07 Shift display left
08 Display off, cursor off
0A Display off, cursor on
0C Display on, cursor off
0E Display on, cursor on (cursor blinking)
0F Display on, cursor on (cursor blinking)
Table : LCD Commands
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 41 / 109
LCD Commands...
Command code (Hex) Command to the LCD instruction register
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 on the first line
C0 Force cursor to beginning on the second line
38 Initialization of the LCD / 2 lines and 5 x 7 matr
Table : LCD Commands
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 42 / 109
Example
Show the interfacing of 16x2 LCD with Microcontroller 8051 and write an
assembly language program to display text message โ€œNB BAHADUREโ€.
Solution
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 43 / 109
Assembly Language Program
Method - I
; P2.0 is connected to the RS pin of LCD
; P2.1 is connected to the R/W pin of LCD
; P2.2 is connected to the E pin of LCD
ORG 0000H
MOV A, #38H ; initialize 16 x 2 LCD
ACALL COMMAND ; send command
ACALL DELAY ; delay for some time
MOV A, #0EH ; display on cursor on
ACALL COMMAND
ACALL DELAY
MOV A, #01H ; clear LCD
ACALL COMMAND
ACALL DELAY
MOV A, #06 ; shift cursor right
ACALL COMMAND
ACALL DELAY
MOV A, #84h ; cursor at line 1, position 4
ACALL COMMAND
ACALL DELAY
MOV A, #โ€™Nโ€™ ; display letter N
ACALL DATA
ACALL DELAY
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 44 / 109
Assembly Language Program
MOV A, #โ€™Bโ€™ ; display letter B
ACALL DATA
ACALL DELAY
MOV A, #โ€™ โ€™ ; display space
ACALL DATA
ACALL DELAY
MOV A, #โ€™Bโ€™ ; display letter B
ACALL DATA
ACALL DELAY
MOV A, #โ€™Aโ€™ ; display letter A
ACALL DATA
ACALL DELAY
MOV A, #โ€™Hโ€™ ; display letter H
ACALL DATA
ACALL DELAY
MOV A, #โ€™Aโ€™ ; display letter A
ACALL DATA
ACALL DELAY
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 45 / 109
Assembly Language Program
MOV A, #โ€™Dโ€™ ; display letter D
ACALL DATA
ACALL DELAY
MOV A, #โ€™Uโ€™ ; display letter U
ACALL DATA
ACALL DELAY
MOV A, #โ€™Rโ€™ ; display letter R
ACALL DATA
ACALL DELAY
MOV A, #โ€™Eโ€™ ; display letter E
ACALL DATA
ACALL DELAY
AGAIN: SJMP AGAIN
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 46 / 109
Assembly Language Program
COMMAND: MOV P1, A
CLR P2.0
CLR P2.1
SETB P2.2
ACALL DELAY
CLR P2.2
RET
DATA: MOV P1,A
SETB P2.0
CLR P2.1
SETB P2.2
ACALL DELAY
CLR P2.2
RET
DELAY: MOV R3, #75H
H2: MOV R4,#0FFH
H1: DJNZ R4,H1
DJNZ R3,H2
RET
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 47 / 109
Assembly Language Program
Method - II
; P2.0 is connected to the RS pin of LCD
; P2.1 is connected to the R/W pin of LCD
; P2.2 is connected to the E pin of LCD
ORG 0000H
MOV DPTR, #COM TAB
BACK: CLR A
MOVC A, @A+DPTR
JZ DATA SEND
ACALL COMMAND
ACALL DELAY
INC DPTR
SJMP BACK
DATA SEND: MOV DPTR, #DATA TAB
BACK1: CLR A
MOVC A, @A+DPTR
JZ STOP
ACALL DATA
ACALL DELAY
INC DPTR
SJMP BACK1
STOP: SJMP STOP
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 48 / 109
Assembly Language Program
COMMAND: MOV P1, A
CLR P2.0
CLR P2.1
SETB P2.2
ACALL DELAY
CLR P2.2
RET
DATA: MOV P1,A
SETB P2.0
CLR P2.1
SETB P2.2
ACALL DELAY
CLR P2.2
RET
DELAY: MOV R3, #75H
H2: MOV R4,#0FFH
H1: DJNZ R4,H1
DJNZ R3,H2
RET
COM TAB: DB 38H, 01H, 06H, 0EH, 84H, 00H
DATA TAB: DB โ€™NB BAHADUREโ€™, 00H
END
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 49 / 109
Proteus Design
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 50 / 109
Stepper Motor
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 51 / 109
Introduction to Stepper Motor
A stepper motor is widely used device that translate electrical pulses into
mechanical movement. In application such as disk drives, dot matrix printers
and robotics, the stepper motor is used for position control. The sequence of
the applied pulses is directly related to the direction of motor shafts rotation.
The speed of the motor shafts rotation is directly related to the frequency
of the input pulses and the length of rotation of input pulses applied. The
advantages and disadvantages of stepper motor are given below.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 52 / 109
Advantages of Stepper Motor
1 The rotation angle of the motor is proportional to the input pulse.
The motor has full torque at stand still (if the winding are energized)
Precise positioning and repeatability of movement since good stepper
motors.
Have an accuracy of 3 -5% of a step and this error is non cumulative
from one step to the next.
Excellent response to starting stopping reversing.
Very reliable since there are no contact brushes in the motor.
Therefore the life to the motor is simply dependant on the life of the
bearing.
The motors response to digital input pulses provides open-loop
control, making the motor simpler and less costly to control.
It is possible to achieve very low speed synchronous rotation with a
load that is directly coupled to the shaft.
A wide range of rotational speed is proportional to the frequency of
the input pulses.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 53 / 109
Disadvantages of Stepper Motor
9 1 Resonance can occur if not properly controlled.
Not easy to operate at extremely high speeds.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 54 / 109
2 The stepper motors commonly have a permanent magnet called rotor (also
called shaft) surrounded by a stator. There are also stepper motors called
variable reluctance stepper motor that do not have permanent magnet rotor.
The most common stepper motors have four stator winding that are paired
with a center tapped common as shown in figure 8
Figure : Stepper Motor
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 55 / 109
Table : Stepping sequence for stepper motor
Clockwise
โ†“
Step Winding A Winding B Winding C Winding D
Counter
Clockwise
โ†‘
1 1 0 0 1
2 1 1 0 0
3 0 1 1 0
4 0 0 1 1
It is to be important to note that although we can start with any of the
sequence in table 6, once we start we must continue in the proper order.
For example if we start with step - 3 we must continue in the sequence of
steps 4 - 1 - 2 - 3 - 4 - 1etc.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 56 / 109
Stepper Motor Types
1 Active rotor: Permanent Magnet (PM)
2 Reactive rotor: Variable reluctance (VR)
3 Combination of VR and PM: Hybrid (HB)
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 57 / 109
Stepper Motor Types I
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 58 / 109
Stepper Motor Types II
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 59 / 109
Stepper Motor Types III
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 60 / 109
Stepper Motor Interfacing Types
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 61 / 109
Connecting Unipolar Stepper Motor using L293D
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 62 / 109
Connecting Unipolar Stepper Motor using ULN2003A
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 63 / 109
Step Sequence
1. Full Step Sequence
2. Half Step Sequence
Table : Full Step Sequence
Clockwise
โ†“
Step A B C D
Counter
Clockwise
โ†‘
1 ON OFF OFF ON
2 ON ON OFF OFF
3 OFF ON ON OFF
4 OFF OFF ON ON
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 64 / 109
Half Step Sequence
Table : Half Step Sequence
Clockwise
โ†“
Step A B C D
Counter
Clockwise
โ†‘
1 ON ON OFF OFF
2 OFF ON OFF OFF
3 OFF ON ON OFF
4 OFF OFF ON OFF
5 OFF OFF ON ON
6 OFF OFF OFF ON
7 ON OFF OFF ON
8 ON OFF OFF OFF
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 65 / 109
Step Angle
Step angle = 360
Steps per Revolutions
Step angle Steps per revolution
0.72 500
1.8 200
2.0 180
2.5 144
5.0 72
7.5 48
15 24
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 66 / 109
Example
Show the interfacing of stepper motor with 8051 Microcontroller and write
an assembly language program to rotate stepper motor clockwise
continuously. Assume the oscillator frequency of 8051 is 11.0592 MHz.
Solution
Hardware Arrangement:
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 67 / 109
Assembly Language Program
Method - I
MOV A, #66h ; Load step sequence
BACK: MOV P0, A ; Issue sequence to motor
RR A ; Rotate right (clockwise pattern)
ACALL DELAY ; Wait for some time
SJMP BACK ; Keep going
DELAY: MOV R7,#04
WAIT2: MOV R6,#0FFH
WAIT1: MOV R5,#0FFH
WAIT: DJNZ R5,WAIT
DJNZ R6,WAIT1
DJNZ R7,WAIT2
RET
END
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 68 / 109
Assembly Language Program
Method - II
ORG 0000H
STEPPER EQU P0
SJMP MAIN
ORG 0030H ; bypass interrupt vector location
MAIN: MOV STEPPER, #0CH
ACALL DELAY
MOV STEPPER, #06H
ACALL DELAY
MOV STEPPER, #03H
ACALL DELAY
MOV STEPPER, #09H
ACALL DELAY
SJMP MAIN
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 69 / 109
Assembly Language Program
DELAY: MOV R7,#04
WAIT2: MOV R6,#0FFH
WAIT1: MOV R5,#0FFH
WAIT: DJNZ R5,WAIT
DJNZ R6,WAIT1
DJNZ R7,WAIT2
RET
END
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 70 / 109
Proteus Design
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 71 / 109
Example
Show the interfacing of stepper motor with 8051 Microcontroller and write
an assembly language program to rotate stepper motor clockwise
continuously in half step sequence. Assume the oscillator frequency of
8051 is 11.0592 MHz.
Solution
Hardware Arrangement:
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 72 / 109
Assembly Language Program
ORG 0000H
STEPPER EQU P0
SJMP MAIN
ORG 0030H ; bypass interrupt vector location
MAIN: MOV STEPPER, #08H
ACALL DELAY
MOV STEPPER, #0CH
ACALL DELAY
MOV STEPPER, #04H
ACALL DELAY
MOV STEPPER, #06H
ACALL DELAY
MOV STEPPER, #02H
ACALL DELAY
MOV STEPPER, #03H
ACALL DELAY
MOV STEPPER, #01H
ACALL DELAY
MOV STEPPER, #09H
ACALL DELAY
SJMP MAIN
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 73 / 109
Assembly Language Program
DELAY: MOV R7,#04
WAIT2: MOV R6,#0FFH
WAIT1: MOV R5,#0FFH
WAIT: DJNZ R5,WAIT
DJNZ R6,WAIT1
DJNZ R7,WAIT2
RET
END
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 74 / 109
Proteus Design
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 75 / 109
Example
A switch is connected to port pin P2.0. Write a program to monitor the
status of switch and perform the following.
(a) If SW = 0 then stepper motor moves clockwise
(b) If SW = 1 then stepper motor moves anticlockwise.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 76 / 109
Solution
Hardware Arrangement:
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 77 / 109
Assembly Language Program
SETB P2.0 ; Initialize port pin P2.0 as an input port
MOV A, #66h
MOV P0, A
TURN: JB P2.0, CCW
RR A
MOV P0, A
ACALL DELAY
SJMP TURN
CCW: RL A
MOV P0, A
ACALL DELAY
SJMP TURN
DELAY: MOV R7, #04
WAIT2: MOV R6,#0FFH
WAIT1: MOV R5,#0FFH
WAIT: DJNZ R5,WAIT
DJNZ R6,WAIT1
DJNZ R7,WAIT2
RET
END
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 78 / 109
DAC
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 79 / 109
Introduction to DAC
Adigital-to-analog converteris a function that converts digital data (usually
binary) into ananalog signal(current,voltage, orelectric charge).
Ananalog-to-digital converter(ADC) performs the reverse function. Unlike
analog signals,digital datacan be transmitted, manipulated, and stored
without degradation, albeit with more complex equipment. But a DAC is
needed to convert the digital signal to analog to drive an earphone or
loudspeaker amplifier in order to produce sound (analog air pressure
waves).
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 80 / 109
Introduction to DAC...
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 81 / 109
Example
Show the interfacing of DAC0808 with 8051 microcontroller. Write an
ALP to generate a saw tooth wave form (stair step ramp) on port P1.
Solution
Hardware Arrangement:
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 82 / 109
Assembly Language Program
CLR A
AGAIN: MOV P1, A ; Send data to DAC
INC A ; Count from 00 to FF
ACALL DELAY ; Let DAC recover
SJMP AGAIN
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 83 / 109
Example
Show the interfacing of DAC0808 with 8051 Microcontroller. Write an
ALP to generate a reverse sawtooth wave form (stair step ramp) on port
P1.
Solution
Hardware Arrangement:
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 84 / 109
Assembly Language Program
MOV A, #0FFh
AGAIN: MOV P1, A ; Send data to DAC
DEC A ; Count from FF to 00
ACALL DELAY ; Let DAC recover
SJMP AGAIN
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 85 / 109
Example
Show the interfacing of DAC0808 with 8051 microcontroller and write an
assembly language program to generate triangular waveform at the DAC
output using port P1 of the microcontroller. Generate 200 cycles use P1.
Solution
Hardware Arrangement:
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 86 / 109
Assembly Language Program
MOV R2, #200
AGAIN: MOV R3, #0FEH
MOV R4, #0FEh
CLR A
L1: MOV P1, A
INC A
ACALL DELAY
DJNZ R3, L1
MOV A, #0FFh
L2: MOV P1, A
DEC A
ACALL DELAY
DJNZ R4, L2
DJNZ R2, AGAIN
END
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 87 / 109
Example
Show the interfacing of DAC 0808 with Microcontroller 8051 and write an
assembly language program to generate sine wave continuously on DAC. The
values to be sent to the DAC for the generation of sine wave is calculated
using the formula given below
VOUT = 5V + (5V ร— sin(ฮธ))
Use port P1 of the 8051. Assume oscillator frequency of the 8051 is 11.0592
MHz. The angle ฮธ should be from 0o to 360o in the increment of 15o.
Solution
To find the values sent to the DAC for various angles we simply multiply
Vout by 25.6 because there are 256 steps and full scale Vout is 10V.
Therefore 256 steps
10V = 25.6 steps per volts
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 88 / 109
Solution
Table : Values send to DAC for sine wave generation for example 4
Angle (decimal) sin ฮธ VOUT = 5V + (5V ร— sin(ฮธ)) Values send to DAC
= VOUT ร— 25.6
0 0 5 128
15 0.259 6.295 161
30 0.5 7.5 192
45 0.707 8.535 218
60 0.866 9.33 238
75 0.966 9.83 251
90 1 10 256
105 0.966 9.83 251
120 0.866 9.33 238
135 0.707 8.535 218
150 0.5 7.5 192
165 0.259 6.295 161
180 0 5 128
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 89 / 109
Solution
Table : Values send to DAC for sine wave generation for example 4
Angle (decimal) sin ฮธ VOUT = 5V + (5V ร— sin(ฮธ)) Values send to DAC
= VOUT ร— 25.6
195 -0.259 3.705 94
210 - 0.5 2.5 64
225 -0.707 1.465 37
240 -0.866 0.67 17
255 -0.966 0.17 4
270 -1 0 0
285 -0.966 0.17 4
300 -0.866 0.67 17
315 -0.707 1.465 37
330 -0.5 2.5 64
345 -0.259 3.705 94
360 0 5 128
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 90 / 109
Assembly Language Program
REP: MOV DPTR, #SIN TABLE
MOV R2, #25 ; for total 25 values from 0 to 360
AGAIN: CLR A
MOVC A, @A+DPTR
MOV P1, A
ACALL DELAY
INC DPTR
DJNZ R2, AGAIN
SJMP REP
DELAY: MOV R7, #20H
BACK: MOV R6, #0FFH
BACK1: MOV R5, #0FFH
HERE: DJNZ R5, HERE
DJNZ R6, BACK1
DJNZ R7, BACK
RET
SIN TABLE: DB 128, 161, 192, 218, 238, 251, 256 . 128
END
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 91 / 109
ADC
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 92 / 109
Introduction to ADC
Analog-to-digital converter is a device that converts a continuous physical
quantity (usually voltage) to a digital number that represents the quantityโ€™s
amplitude. The conversion involves quantization of the input, so it necessar-
ily introduces a small amount of error. Instead of doing a single conversion,
an ADC often performs the conversions periodically. The result is a sequence
of digital values that have converted a continuous-time and continuous-
amplitude analog signal to a discrete-time and discrete-amplitude digital
signal.
The table 11 shows the various analog to digital converters that are most
commonly used with the Microcontroller 8051 and family.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 93 / 109
Introduction to ADC...
Table : Analog to digital converter ICโ€™s
Name of the IC Description
ADC 0800 8 - bit ADC
ADC 0801 8 - bit ADC, 100 ยตs, 0.25 LSB
ADC 0802 8 - bit ADC, 100 ยตs, 0.5 LSB
ADC 0804 8 - bit ADC, 100 ยตs, 1.0 LSB
ADC 0808 8 - bit 8 channel ADC, 100 ยตs
ADC 0809 8 - bit 8 channel ADC (equivalent to ADC 0808)
AD 571 10 bit, ADC, with reference and clock signals
MAX 1204 5V, 8 - channel, serial, 10 bit ADC with 3V digital interface
MAX 1202 5V, 8 - channel, serial, 12 bit ADC with 3V digital interface
MAX 195 1 6 - bit, self calibrating, 10 ยตs sampling ADC
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 94 / 109
Example
Show the interfacing of ADC 0804 with Microcontroller 8051 and write an
assembly language program to read the value and store in internal memory
location 30h.
Solution
Pin configuration of ADC 0804
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 95 / 109
Solution
Hardware Arrangement
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 96 / 109
Solution
The following points are observed to start the conversion
1 Make chip select (CS) signal low to select the ADC 0804
2 Make write (WR) signal low.
3 Make chip select high
4 Wait for INTR signal to go low, when it goes low, indicates
conversion ends.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 97 / 109
Solution
Once the conversion in ADC is done, the data is available in the output
latch of the ADC. Data of new conversion is only available for reading after
ADC 0804 made INTR signal low or say when the conversion is completed.
Below are the steps observed to read output from the ADC 0804.
1 Make chip select (CS) pin low.
2 Make read (RD) signal low.
3 Read the data from port where ADC is connected.
4 Make read (RD) signal high.
5 Make chip select (CS) high.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 98 / 109
Assembly Language Program
RD EQU P1.0 ; Read signal P1.0
WR EQU P1.1 ; Write signal P1.1
CS EQU P1.2 ; Chip select signal P1.2
INTR EQU P1.3 ; INTR signal P1.3
ADC PORT EQU P2 ; ADC data port pin P2
ORG 0000h
START: ACALL CONV ; Start ADC Conversion
ACALL READ ; Read converted value
MOV P3, 30h ; Move the value to the port P3
SJMP START ; repeat the process
CONV: CLR CS ; make CS low
CLR WR ; make WR low
NOP ; give small delay
SETB WR ; make WR high
SETB CS ; make CS high
WAIT: JB INTR, WAIT ; Wait for INTR signal
RET ; Conversion completed
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 99 / 109
Assembly Language Program
READ: CLR CS ; make CS low
CLR RD ; make RD low
MOV A, ADC PORT ; Read the converted value
MOV 30h, A ; Store the converted value in internal RAM 30h
SETB RD ; make RD high
SETB CS ; Make CS high
RET ; Reading completed
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 100 / 109
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 101 / 109
Introduction to Keyboard
Keyboards are organized in a matrix of rows and columns. The CPU accesses
both rows and columns through ports therefore with two 8 bit ports an
8 x 8 matrix of keys can be connected to the Microcontroller. When a
key is pressed, a row and a column make a contact; otherwise there is no
connection between rows and column.
Scanning and identification of the key:
Figure shows a 4 x 4 matrix keyboard connected to two ports. The rows are
connected to the output port and the columns are connected to the input
port. If no key has been pressed, reading the input port will yield 1s for all
columns. Since they are all connected to the high (Vcc). If all the rows are
grounded and a key is pressed one of the column will have 0 since the key is
pressed provides the path to ground. If the function of the Microcontroller
to scan the keyboard continuously to detect and identify the key pressed.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 102 / 109
Introduction to Keyboard...
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 103 / 109
Introduction to Keyboard...
Grounding rows and reading the column:
To detect a pressed key, the Microcontroller grounds all rows by providing
0 to the output latch then it reads the column. If the data read from the
column is D3 - D0 = 1111, no key has been pressed and process continuous
until a key pressed is detected. However, if one of the column bit has a zero,
this means that a key has occurred. For ex: if D3 - D0 = 1101, this means
that a key in D1 column has been pressed. After a key press is detected, the
Microcontroller will go through the process of identifying the key. Starting
with the top row, the Microcontroller grounds it by providing a low to row
D0 only; then it reads the column. If the data read is all 1โ€™s, no key in that
row is activated and the process is moved to the next row. It grounds the
next row, reads the column and check for any zero. This process continuous
until the row is identified. After identification if the row in which the key
has been pressed, the next task is to find out which column the pressed key
belongs to. This should be easy since Microcontroller knows at any time
which row and column are being occurred.
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 104 / 109
Example
Interface 4 x 4 matrix keyboards with Microcontroller 8051. Write an ALP
to read the keypad and send the ASCII code of pressed key to port P0.
P1.0 - P1.3 connected to rows (Output)
P2.0 - P 2.3 connected to the column (Input)
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 105 / 109
Assembly Language Program
MOV P2, #0FFh ; P2 input
K1: MOV P1, #00h ; Grounds all rows at once
MOV A, P2 ; Reads column ensure all key open
ANL A, #0Fh ; mask unused bits
CJNE A, #0Fh, K1 ; check till all keys are released
ACALL DELAY ; 20ms DELAY
K2: MOV A, P2 ; SEE ANY KEY PRESSED
ANL A, #0F
CJNE A, #0F, OVER
SJMP K2
OVER: ACALL DELAY
MOV A, P2
ANL A, #0F
CJNE A, #0F, OVER1 ; Key pressed find row
SJMP K2 ; if none keep poling
OVER1: MOV P1, #11111110B ; GROUND ROW 0
MOV A, P2
ANL A, #0F
CJNE A, #0F, ROW 0
MOV P1, #11111101B ; GROUND ROW 1
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 106 / 109
Assembly Language Program
MOV A, P2
ANL A, #0F
CJNE A, #0F, ROW 1
MOV P1, #11111011B ; GROUND ROW 2
MOV A, P2
ANL A, #0F
CJNE A, #0F, ROW 2
MOV P1, #11110111B ; GROUND ROW 3
MOV A, P2
ANL A, #0F
CJNE A, #0F, ROW 3
LJMP K2 ; IF NONE FALSE INPUT, REPEAT
ROW 0: MOV DPTR, #KCODE0
SJMP FIND
ROW 1: MOV DPTR, #KCODE1
SJMP FIND
ROW 2: MOV DPTR, #KCODE2
SJMP FIND
ROW 3: MOV DPTR, #KCODE3
SJMP FIND
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 107 / 109
Assembly Language Program
FIND: RRC A ; See if any CY bit is low
JNC ASC ; if zero get ASCII code
INC DPTR
SJMP FIND
; Suppose A= 11111110 it means column 0 is detected so send ASCII
ASC: CLR A
MOVC A, @A+DPTR
MOV P0, A
LJMP K1
; ASCII Look up table for each row
KCODE0: DB โ€™0โ€™, โ€™1โ€™, โ€™2โ€™, โ€™3โ€™ ; row 0
KCODE1: DB โ€™4โ€™, โ€™5โ€™, โ€™6โ€™, โ€™7โ€™ ; row 1
KCODE2: DB โ€™8โ€™, โ€™9โ€™, โ€™Aโ€™ ,โ€™Bโ€™ ; row 2
KCODE3: DB โ€™Cโ€™, โ€™Dโ€™, โ€™Eโ€™, โ€™Fโ€™ ; row 3
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 108 / 109
Thank you
Please send your feedback at nbahadure@gmail.com
For more details and updates kindly visit
https://sites.google.com/site/nileshbbahadure/home
Main Slide
Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 109 / 109

More Related Content

What's hot

Tร i liแป‡u PCL tแป•ng hแปฃp
Tร i liแป‡u PCL tแป•ng hแปฃpTร i liแป‡u PCL tแป•ng hแปฃp
Tร i liแป‡u PCL tแป•ng hแปฃp
Minh Hoร ng
ย 
Spartan 3e-vietnamese
Spartan 3e-vietnameseSpartan 3e-vietnamese
Spartan 3e-vietnamese
buianhminh
ย 

What's hot (20)

Verilog coding of demux 8 x1
Verilog coding of demux  8 x1Verilog coding of demux  8 x1
Verilog coding of demux 8 x1
ย 
7 segment led interfacing with 8051
7 segment led interfacing with 80517 segment led interfacing with 8051
7 segment led interfacing with 8051
ย 
1st Semester M Tech CMOS VLSI Design (Dec-2013) Question Papers
1st Semester M Tech CMOS VLSI Design (Dec-2013) Question Papers1st Semester M Tech CMOS VLSI Design (Dec-2013) Question Papers
1st Semester M Tech CMOS VLSI Design (Dec-2013) Question Papers
ย 
Xแปญ lรฝ tรญn hiแป‡u sแป‘
Xแปญ lรฝ tรญn hiแป‡u sแป‘Xแปญ lรฝ tรญn hiแป‡u sแป‘
Xแปญ lรฝ tรญn hiแป‡u sแป‘
ย 
Timer And Counter in 8051 Microcontroller
Timer And Counter in 8051 MicrocontrollerTimer And Counter in 8051 Microcontroller
Timer And Counter in 8051 Microcontroller
ย 
microcontroller vs microprocessor
microcontroller vs microprocessormicrocontroller vs microprocessor
microcontroller vs microprocessor
ย 
5 Simple Arduino Projects for Beginners
5 Simple Arduino Projects for Beginners5 Simple Arduino Projects for Beginners
5 Simple Arduino Projects for Beginners
ย 
M Tech 2nd Semester (CMOS VLSI) Question papers
M Tech 2nd Semester (CMOS VLSI) Question papers M Tech 2nd Semester (CMOS VLSI) Question papers
M Tech 2nd Semester (CMOS VLSI) Question papers
ย 
Calculator design with lcd using fpga
Calculator design with lcd using fpgaCalculator design with lcd using fpga
Calculator design with lcd using fpga
ย 
THIแบพT Kแบพ Vร€ THI Cร”NG LED CUBE 5X5X5 Dร™NG VI ฤIแป€U KHIแป‚N AT89S52
THIแบพT Kแบพ Vร€ THI Cร”NG LED CUBE 5X5X5 Dร™NG VI ฤIแป€U KHIแป‚N AT89S52THIแบพT Kแบพ Vร€ THI Cร”NG LED CUBE 5X5X5 Dร™NG VI ฤIแป€U KHIแป‚N AT89S52
THIแบพT Kแบพ Vร€ THI Cร”NG LED CUBE 5X5X5 Dร™NG VI ฤIแป€U KHIแป‚N AT89S52
ย 
Code matlab mรด phแปng dung lฦฐแปฃng kรชnh truy แปn reyleght trong kฤฉ thuแบญt mimo
Code matlab mรด phแปng dung lฦฐแปฃng kรชnh truy แปn reyleght trong kฤฉ thuแบญt mimoCode matlab mรด phแปng dung lฦฐแปฃng kรชnh truy แปn reyleght trong kฤฉ thuแบญt mimo
Code matlab mรด phแปng dung lฦฐแปฃng kรชnh truy แปn reyleght trong kฤฉ thuแบญt mimo
ย 
Verilog coding of mux 8 x1
Verilog coding of mux  8 x1Verilog coding of mux  8 x1
Verilog coding of mux 8 x1
ย 
Lแบญp trรฌnh pic hainguyen
Lแบญp trรฌnh pic hainguyenLแบญp trรฌnh pic hainguyen
Lแบญp trรฌnh pic hainguyen
ย 
Tร i liแป‡u PCL tแป•ng hแปฃp
Tร i liแป‡u PCL tแป•ng hแปฃpTร i liแป‡u PCL tแป•ng hแปฃp
Tร i liแป‡u PCL tแป•ng hแปฃp
ย 
Kts cac bt giai san ve vhdl 2011
Kts cac bt giai san ve vhdl 2011Kts cac bt giai san ve vhdl 2011
Kts cac bt giai san ve vhdl 2011
ย 
Spartan 3e-vietnamese
Spartan 3e-vietnameseSpartan 3e-vietnamese
Spartan 3e-vietnamese
ย 
Giรกo trรฌnh thiแบฟt kแบฟ mแบกch logic sแป‘
Giรกo trรฌnh thiแบฟt kแบฟ mแบกch logic sแป‘Giรกo trรฌnh thiแบฟt kแบฟ mแบกch logic sแป‘
Giรกo trรฌnh thiแบฟt kแบฟ mแบกch logic sแป‘
ย 
Luแบญn vฤƒn: Thiแบฟt kแบฟ mแบกch ฤ‘iแปu khiแปƒn tแป‘c ฤ‘แป™ ฤ‘แป™ng cฦก mแป™t chiแปu, HAY
Luแบญn vฤƒn: Thiแบฟt kแบฟ mแบกch ฤ‘iแปu khiแปƒn tแป‘c ฤ‘แป™ ฤ‘แป™ng cฦก mแป™t chiแปu, HAYLuแบญn vฤƒn: Thiแบฟt kแบฟ mแบกch ฤ‘iแปu khiแปƒn tแป‘c ฤ‘แป™ ฤ‘แป™ng cฦก mแป™t chiแปu, HAY
Luแบญn vฤƒn: Thiแบฟt kแบฟ mแบกch ฤ‘iแปu khiแปƒn tแป‘c ฤ‘แป™ ฤ‘แป™ng cฦก mแป™t chiแปu, HAY
ย 
ฤแป tร i: Xรขy dแปฑng bร i thรญ nghiแป‡m xแปญ lรฝ tรญn hiแป‡u sแป‘ trรชn Matlab
ฤแป tร i: Xรขy dแปฑng bร i thรญ nghiแป‡m xแปญ lรฝ tรญn hiแป‡u sแป‘ trรชn Matlabฤแป tร i: Xรขy dแปฑng bร i thรญ nghiแป‡m xแปญ lรฝ tรญn hiแป‡u sแป‘ trรชn Matlab
ฤแป tร i: Xรขy dแปฑng bร i thรญ nghiแป‡m xแปญ lรฝ tรญn hiแป‡u sแป‘ trรชn Matlab
ย 
Programming with PIC microcontroller
Programming with PIC microcontroller Programming with PIC microcontroller
Programming with PIC microcontroller
ย 

Similar to Applications of Microcontroller 8051

7-Segment Display
7-Segment Display7-Segment Display
7-Segment Display
May Ann Mas
ย 
Ee2 chapter10 led
Ee2 chapter10 ledEe2 chapter10 led
Ee2 chapter10 led
CK Yang
ย 
table of contents and index of EIC department govt. engineering college ajmer
table of contents and index of EIC department govt. engineering college ajmer table of contents and index of EIC department govt. engineering college ajmer
table of contents and index of EIC department govt. engineering college ajmer
Veni Dan
ย 
Lcd tutorial
Lcd tutorialLcd tutorial
Lcd tutorial
Sujan Heuju
ย 

Similar to Applications of Microcontroller 8051 (20)

seven segment display using 74LS78 IC decoder
seven segment display using 74LS78 IC decoderseven segment display using 74LS78 IC decoder
seven segment display using 74LS78 IC decoder
ย 
Digital electronics digital coders decoder encoder adder
Digital electronics digital coders decoder encoder adderDigital electronics digital coders decoder encoder adder
Digital electronics digital coders decoder encoder adder
ย 
Project report
Project reportProject report
Project report
ย 
7-Segment Display
7-Segment Display7-Segment Display
7-Segment Display
ย 
Project report
Project reportProject report
Project report
ย 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
ย 
The Power Saving Low Cost Rotating 8 Led Information Display
The Power Saving Low Cost Rotating 8 Led Information DisplayThe Power Saving Low Cost Rotating 8 Led Information Display
The Power Saving Low Cost Rotating 8 Led Information Display
ย 
Introduction to seven segment display new
Introduction to seven segment display newIntroduction to seven segment display new
Introduction to seven segment display new
ย 
IRJET - Automatic Mechanism for LED Parameters Testing & Checking
IRJET -  	  Automatic Mechanism for LED Parameters Testing & CheckingIRJET -  	  Automatic Mechanism for LED Parameters Testing & Checking
IRJET - Automatic Mechanism for LED Parameters Testing & Checking
ย 
The Design and Construction of a low cost Propeller Led Display.
The Design and Construction of a low cost Propeller Led Display.The Design and Construction of a low cost Propeller Led Display.
The Design and Construction of a low cost Propeller Led Display.
ย 
Ee2 chapter10 led
Ee2 chapter10 ledEe2 chapter10 led
Ee2 chapter10 led
ย 
BCD Counter
BCD CounterBCD Counter
BCD Counter
ย 
"BCD TO 7 SEGMENT DISPLAY DECODER"
"BCD TO 7 SEGMENT DISPLAY DECODER""BCD TO 7 SEGMENT DISPLAY DECODER"
"BCD TO 7 SEGMENT DISPLAY DECODER"
ย 
Comparison of Cascaded H-Bridge Multilevel Inverter connected to grid using P...
Comparison of Cascaded H-Bridge Multilevel Inverter connected to grid using P...Comparison of Cascaded H-Bridge Multilevel Inverter connected to grid using P...
Comparison of Cascaded H-Bridge Multilevel Inverter connected to grid using P...
ย 
Encoder decoder Adc LDR &7 Segment PPT
Encoder decoder Adc LDR &7 Segment  PPTEncoder decoder Adc LDR &7 Segment  PPT
Encoder decoder Adc LDR &7 Segment PPT
ย 
table of contents and index of EIC department govt. engineering college ajmer
table of contents and index of EIC department govt. engineering college ajmer table of contents and index of EIC department govt. engineering college ajmer
table of contents and index of EIC department govt. engineering college ajmer
ย 
IRJET - Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
IRJET -  	  Interfacing Multi-Digit 7-Segment with 8051 MicrocontrollerIRJET -  	  Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
IRJET - Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
ย 
Lcd tutorial
Lcd tutorialLcd tutorial
Lcd tutorial
ย 
Floating point ALU using VHDL implemented on FPGA
Floating point ALU using VHDL implemented on FPGAFloating point ALU using VHDL implemented on FPGA
Floating point ALU using VHDL implemented on FPGA
ย 
Design, Construction and Operation of a 4-Bit Counting Circuit
Design, Construction and Operation of a 4-Bit Counting CircuitDesign, Construction and Operation of a 4-Bit Counting Circuit
Design, Construction and Operation of a 4-Bit Counting Circuit
ย 

More from Nilesh Bhaskarrao Bahadure

More from Nilesh Bhaskarrao Bahadure (20)

Biomedical Signal Origin and Dynamics
Biomedical Signal Origin and DynamicsBiomedical Signal Origin and Dynamics
Biomedical Signal Origin and Dynamics
ย 
Introduction to Medical Image Processing
Introduction to Medical Image ProcessingIntroduction to Medical Image Processing
Introduction to Medical Image Processing
ย 
Timing diagram of microprocessor 8085
Timing diagram of microprocessor 8085Timing diagram of microprocessor 8085
Timing diagram of microprocessor 8085
ย 
Timers and counters of microcontroller 8051
Timers and counters of microcontroller 8051Timers and counters of microcontroller 8051
Timers and counters of microcontroller 8051
ย 
Serial communication of microcontroller 8051
Serial communication of microcontroller 8051Serial communication of microcontroller 8051
Serial communication of microcontroller 8051
ย 
Peripherals of Microprocessor 8085
Peripherals of Microprocessor 8085Peripherals of Microprocessor 8085
Peripherals of Microprocessor 8085
ย 
Microprocessor 8085 Basics
Microprocessor 8085 BasicsMicroprocessor 8085 Basics
Microprocessor 8085 Basics
ย 
Microcontroller 8051 instruction set and assemble directives
Microcontroller 8051 instruction set and assemble directivesMicrocontroller 8051 instruction set and assemble directives
Microcontroller 8051 instruction set and assemble directives
ย 
Microcontroller 8051 basics (part I)
Microcontroller 8051 basics (part I)Microcontroller 8051 basics (part I)
Microcontroller 8051 basics (part I)
ย 
Memory interfacing of microprocessor 8085
Memory interfacing of microprocessor 8085Memory interfacing of microprocessor 8085
Memory interfacing of microprocessor 8085
ย 
Memory interfacing of microcontroller 8051
Memory interfacing of microcontroller 8051Memory interfacing of microcontroller 8051
Memory interfacing of microcontroller 8051
ย 
Interrupts of microprocessor 8085
Interrupts of microprocessor 8085Interrupts of microprocessor 8085
Interrupts of microprocessor 8085
ย 
Interrupts of microcontroller 8051
Interrupts of microcontroller 8051Interrupts of microcontroller 8051
Interrupts of microcontroller 8051
ย 
Instruction sets of microprocessor 8085
Instruction sets of microprocessor 8085Instruction sets of microprocessor 8085
Instruction sets of microprocessor 8085
ย 
Embedded Systems
Embedded Systems Embedded Systems
Embedded Systems
ย 
Basic Electronics Semiconductor Diodes
Basic Electronics Semiconductor DiodesBasic Electronics Semiconductor Diodes
Basic Electronics Semiconductor Diodes
ย 
Basic Electronics Electrical Transducers
Basic Electronics Electrical TransducersBasic Electronics Electrical Transducers
Basic Electronics Electrical Transducers
ย 
Basic Electronics BJT
Basic Electronics BJTBasic Electronics BJT
Basic Electronics BJT
ย 
Question Bank Programmable Logic Controller
Question Bank Programmable Logic ControllerQuestion Bank Programmable Logic Controller
Question Bank Programmable Logic Controller
ย 
Question Bank Microprocessor 8085
Question Bank Microprocessor 8085Question Bank Microprocessor 8085
Question Bank Microprocessor 8085
ย 

Recently uploaded

Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night StandCall Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
amitlee9823
ย 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
ย 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
ย 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
SUHANI PANDEY
ย 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
KreezheaRecto
ย 

Recently uploaded (20)

Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
ย 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
ย 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
ย 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
ย 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
ย 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
ย 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
ย 
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
ย 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
ย 
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night StandCall Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
Call Girls In Bangalore โ˜Ž 7737669865 ๐Ÿฅต Book Your One night Stand
ย 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ย 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
ย 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
ย 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
ย 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
ย 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
ย 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
ย 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
ย 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
ย 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
ย 

Applications of Microcontroller 8051

  • 1. Applications of 8051 Microcontroller Dr. Nilesh Bhaskarrao Bahadure https://www.sites.google.com/site/nileshbbahadure/home July 25, 2021 Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 1 / 109
  • 2. Overview I 1 Light Emitting Diodes Introduction to LED Example - 1: Single LED Example - 2: Multiple LED Example - 3: Multiple LED 2 Seven Segment LED Introduction to Seven Segment LED Example - 1: Single 7 - Segment to display number 3 Example - 2: Single 7 - Segment for display 0 - 9 Example - 3: Single 7 - Segment for display 0 - 9 using 7447 Decoder Example - 4: Two 7 - Segment for display 31 3 LCD Interfacing LCD Introduction LCD Commands Example - 1: Display NB Bahadure on LCD 4 Stepper Motor Interfacing Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 2 / 109
  • 3. Overview II Introduction to Stepper Motor Stepper motor types Step Sequence Step Angle Example - 1: Rotate Stepper Motor Clockwise Example - 2: Rotate Stepper Motor Clockwise in Half Step Sequence Example - 3: Rotate Stepper Motor Clockwise - Counter Clockwise based on Switch 5 Digital to Analog Converter Introduction to DAC Example - 1: Generate Sawtooth Waveform Example - 2: Generate Reverse Sawtooth Waveform Example - 3: Generate 200 Triangular Waveform Example - 4: Generate Sine Waveform 6 ADC Interfacing Introduction to ADC Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 3 / 109
  • 4. Overview III Example - 1: Interfacing ADC 0804 with 8051 7 Keyboard Interfacing Introduction to Keyboard Example - 1: Interfacing of 4 x 4 Matrix Keyboard with 8051 Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 4 / 109
  • 5. Light Emitting Diodes Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 5 / 109
  • 6. Introduction to LED Light emitting diodes, commonly called LEDs, are real unsung heroes in the electronics world. They do dozens of different jobs and are found in all kinds of devices. Among other things, they form numbers ondigi- tal clocks, transmit information fromremote controls, light up watches and tell you when your appliances are turned on. Collected together, they can form images on ajumbo television screenorilluminate a traffic light. Alight- emitting diode(LED) is a two-leadsemiconductorlight source that resembles a basicPN-junctiondiode, except that an LED also emits light.When an LEDโ€™s anode lead has a voltage that is more positive than its cathode lead by at least the LEDโ€™s forward voltage drop, current flows.Electronsare able to recombine withholeswithin the device, releasing energy in the form of- photons. This effect is calledelectroluminescent, and the color of the light (corresponding to the energy of the photon) is determined by the energy bandof the semiconductor. An LED is often small in area, and integrated optical components may be used to shape itsradiation pattern. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 6 / 109
  • 7. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 7 / 109
  • 8. To interface LEDโ€™s with microprocessor or Microcontroller based system, we must consider the following LEDโ€™s glow only when they are forward biased and Their resistance is almost zero for all practical purpose. It means that they must be interfaced with proper polarity and with a proper value of resistance in series. This resistance is a current limiting resistor, and its value is to be calculated as per the supplied voltage applied to the LED and current limit of the LED. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 8 / 109
  • 9. Example Show the interfacing of LED with port pin P2.1 of Microcontroller 8051 and write an assembly language program to blink LED continuously. Assume that operating frequency of 8051 Microcontroller is 11.0592 MHz. Solution Hardware Arrangement: Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 9 / 109
  • 10. Method - I Assembly Language Program ORG 0000h LOOP: CLR P2.1 ACALL DELAY SETB P2.1 ACALL DELAY JMP LOOP DELAY: MOV R3, #0FFH REP: MOV R2, #0FFH HERE: DJNZ R2, HERE DJNZ R3, REP RET Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 10 / 109
  • 11. Method - II Assembly Language Program ORG 0000h LOOP: CPL P2.1 ACALL DELAY JMP LOOP DELAY: MOV R3, #0FFH REP: MOV R2, #0FFH HERE: DJNZ R2, HERE DJNZ R3, REP RET Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 11 / 109
  • 12. Example Show the interfacing of 8 - LEDโ€™s using common anode arrangement with port 2 pins of 8051 microcontroller. Write an assembly language program to blink the LEDโ€™s continuously. Assume operating frequency of 8051 Mi- crocontroller is 11.0592 MHz. Solution Hardware Arrangement: Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 12 / 109
  • 13. Assembly Language Program ORG 0000h MOV A, #55h LOOP: CPL A MOV P2, A ACALL DELAY SETB P2.1 ACALL DELAY JMP LOOP DELAY: MOV R3, #0FFH REP: MOV R2, #0FFH HERE: DJNZ R2, HERE DJNZ R3, REP RET Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 13 / 109
  • 14. Proteus Design Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 14 / 109
  • 15. Example Show the interfacing of LED with port pin P2.0 of Microcontroller 8051 and write an assembly language program to ON the LED when the key K1 is pressed and OFF the LED when key is pressed k2. Assume that operating frequency of 8051 Microcontroller is 11.0592 MHz. Solution Hardware Arrangement: Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 15 / 109
  • 16. Assembly Language Program ORG 0000h SETB P1.0 ; Set port pin P1.0 as input (key K1) SETB P1.1 ; Set port pin P1.1 as input (key K2) LOOP: MOV A, P1 ; Read key values RRC A ; Rotate towards right to check key K1 JC KEY K2 ; If carry key K1 is not pressed go for key K2 CLR P2.0 ; if no carry key K1 is pressed ON the LED ACALL DELAY SJMP LOOP KEY K2: RRC A ; Rotate towards right to check key K2 JC LOOP ; If carry read the keys again and repeat SETB P2.0 ; If no carry key K2 is pressed OFF the LED ACALL DELAY SJMP LOOP Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 16 / 109
  • 17. Assembly Language Program DELAY: MOV R3, #0FFH REP: MOV R2, #0FFH HERE: DJNZ R2, HERE DJNZ R3, REP RET Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 17 / 109
  • 18. Proteus Design Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 18 / 109
  • 19. Seven Segment LED Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 19 / 109
  • 20. Introduction to Seven Segment LED The Light Emitting Diode (LED) finds its place in many applications in these modern electronic fields. One of them is the Seven Segment Display. Seven- segment displays contains the arrangement of the LEDโ€™s in โ€œEightโ€ (8) passion, and a Dot (.) with a common electrode, lead (Anode or Cathode). The purpose of arranging it in that passion is that we can make any number out of that by switching ON and OFF the particular LEDโ€™s. Figure 1 shows the block diagram of the Seven Segment LED arrangement. Figure : Seven Segment Display Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 20 / 109
  • 21. Introduction to Seven Segment LED... 7 segment displays are basically 7 LEDโ€™s. There are two types of 7 segment displays common cathode and common anode. (a) Common Cathode - where all the segment share the same cathode. (b) Common Anode - where all the segment share the sane anode. In common Anode in order to turn ON a segment the corresponding pin must be set to 0 and to turn it OFF it is set to 1. Similarly in common cathode in order to turn ON a segment the corresponding pin must be set to 1 and to turn it OFF it is set to 0. As shown in the figure 2 in common anode type, all the anodes of LEDโ€™s are connected common with the +5V power supply and hence the name common anode 7 - segment LED. Similarly for common cathode configuration, it shows that all the cathodes of LEDs are connected common to the ground, and hence the name common cathode 7 - segment LED. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 21 / 109
  • 22. Introduction to Seven Segment LED... Figure : Seven Segment Display Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 22 / 109
  • 23. There 2 methods of interfacing LED with the Microcontroller Intel 8051/ AT89C51. (a) Using lookup table. This uses 7 output pins of Microcontroller (b) Using 7447 decoder. This method uses 4 output pins of Microcontroller The difference between the two main methods is simple and clear. In both the cases, Microcontroller communicates with external world through its ports. But, in the 1st case, we connect all the 8 pins of the port directly to the LED and control the voltage through the ports manually to display the desired number. But, in the second case, we send the BCD of the number that we wanted to display to a middleware IC 7447, the BCD to LED code converter, which by itself gives out the correspondent 7 segment codes to the LED. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 23 / 109
  • 24. Look - up table for Seven Segment LED Hex Code seven segment conversion 7 - seg equivalent dot g f e d c b a 0 1 1 0 0 0 0 0 0 C0H 1 1 1 1 1 1 0 0 1 F9H 2 1 0 1 0 0 1 0 0 A4H 3 1 0 1 1 0 0 0 0 B0H 4 1 0 0 1 1 0 0 1 99H 5 1 0 0 1 0 0 1 0 92H 6 1 0 0 0 0 0 1 0 82H 7 1 1 1 1 1 0 0 0 F8H 8 1 0 0 0 0 0 0 0 80H 9 1 0 0 1 1 0 0 0 98H Table : 7 - segment display code for the common anode configuration Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 24 / 109
  • 25. Look - up table for Seven Segment LED Hex Code seven segment conversion 7 - seg equivalent dot g f e d c b a 0 0 0 1 1 1 1 1 1 3FH 1 0 0 0 0 0 1 1 0 06H 2 0 1 0 1 1 0 1 1 5BH 3 0 1 0 0 1 1 1 1 4FH 4 0 1 1 0 0 1 1 0 66H 5 0 1 1 0 1 1 0 1 6DH 6 0 1 1 1 1 1 0 1 7DH 7 0 0 0 0 0 1 1 1 07H 8 0 1 1 1 1 1 1 1 7FH 9 0 1 1 0 0 1 1 1 67H Table : 7 - segment display code for the common cathode configuration Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 25 / 109
  • 26. Example Show the interfacing of seven segment display device of common anode type with 8051 Microcontroller and write an assembly language program to display digit 3 continuously. Assume that operating frequency of 8051 Microcontroller is 11.0592 MHz. Solution Figure : Hardware arrangement Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 26 / 109
  • 27. Assembly Language Program using common anode ORG 0000H MOV P2, #0FFH ; OFF all the LEDโ€™s LOOP: MOV P2, #0B0H ; display code for 3 ACALL DELAY SJMP LOOP DELAY: MOV R3, #0FFH REP: MOV R2, #0FFH HERE: DJNZ R2, HERE DJNZ R3, REP RET Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 27 / 109
  • 28. Proteus Design Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 28 / 109
  • 29. Example Show the interfacing of seven segment display device common anode type with 8051 Microcontroller and write an assembly language program to dis- play digit 0 to 9 continuously. Assume that operating frequency of 8051 Microcontroller is 11.0592 MHz. Solution Figure : Hardware arrangement Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 29 / 109
  • 30. Assembly Language Program using common anode ORG 0000h REPEAT: MOV R2, #10 MOV DPTR, #MSG LOOP: CLR A MOVC A, @A+DPTR MOV P2,A ACALL DELAY INC DPTR DJNZ R2, LOOP LJMP REPEAT Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 30 / 109
  • 31. Assembly Language Program DELAY: MOV R3, #0FFH REP: MOV R4, #0FFH MOV R5, #0FFH HERE: DJNZ R5, HERE HERE1: DJNZ R4, HERE1 DJNZ R3, REP RET MSG: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,98H END Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 31 / 109
  • 32. Example Show the interfacing of seven segment display device of common anode type using 7447 decoder with 8051 Microcontroller and write an assembly lan- guage program to display digits 0 to 9 continuously. Assume that operating frequency of 8051 Microcontroller is 11.0592 MHz. Solution Figure : Hardware arrangement Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 32 / 109
  • 33. Assembly Language Program ORG 0000h AGAIN: MOV A, #00H ; Start form zero UP: MOV P2, A ; Move to Port 2 ACALL DELAY INC A CJNE A, #0AH, UP ; send only from 0 to 9 SJMP AGAIN DELAY: MOV R3, #0FFH REP: MOV R4, #0FFH MOV R5, #0FFH HERE: DJNZ R5, HERE HERE1: DJNZ R4, HERE1 DJNZ R3, REP RET Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 33 / 109
  • 34. Proteus Design Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 34 / 109
  • 35. Example Show the interfacing of two 7 - segment LED with Microcontroller 8051, and write an assembly language program to display digit 31 continuously. For the delay, assume that operating frequency of 8051 Microcontroller is 11.0592 MHz. Solution Figure : Interfacing of two 7 - segment LED in Common anode configuration with 8051 Microcontroller Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 35 / 109
  • 36. Assembly Language Program ORG 0000h CLR P3.0 CLR P3.1 MOV P2, #0FFh ; Off All seven segment display Loop: CLR P3.0 SETB P3.1 MOV P2, #0B0h CALL delay CLR P3.1 SETB P3.0 MOV P2, #0F9h CALL delay AJMP Loop Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 36 / 109
  • 37. Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 37 / 109
  • 38. The most commonly used Character based LCDs are based on Hitachiโ€™s HD44780 controller or other which are compatible with HD44580. In this application, we will discuss about character based LCDs, their interfacing with Microcontroller 8051 Figure : Character LCD type HD44780 pin diagram Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 38 / 109
  • 39. Table : Pin description of character LCD type HD44780 Pin No. Name Description 1 VSS Power Supply (GND) 2 VCC Power Supply (+5V) 3 VEE Contrast adjust 4 RS Register Select 0 = To select command register 1 = To select Data register 5 R/W Read/Write 0 = Write to the LCD 1 = Read from the LCD 6 EN Enable Signal 7 D0 Data bus line D0 (LSB) 8 D1 Data bus line D1 9 D2 Data bus line D2 10 D3 Data bus line D3 11 D4 Data bus line D4 12 D5 Data bus line D5 Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 39 / 109
  • 40. LCD Commands Only the instruction register (IR) and the data register (DR) of the LCD can be controlled by the MCU. Before starting the internal operation of the LCD, control information is temporarily stored into these registers to allow interfacing with various MCUs, which operate at different speeds, or various peripheral control devices. The internal operation of the LCD is determined by signals sent from the MCU. These signals, which include register selection signal (RS), read/write signal (R/W), and the data bus (DB0 to DB7), make up the LCD instructions Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 40 / 109
  • 41. LCD Commands... Command code (Hex) Command to the LCD instruction register 01 Clear display screen 02 Return home 04 Decrement cursor (shift cursor to left) 06 Increment cursor (shift cursor to right) 05 Shift display right 07 Shift display left 08 Display off, cursor off 0A Display off, cursor on 0C Display on, cursor off 0E Display on, cursor on (cursor blinking) 0F Display on, cursor on (cursor blinking) Table : LCD Commands Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 41 / 109
  • 42. LCD Commands... Command code (Hex) Command to the LCD instruction register 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 on the first line C0 Force cursor to beginning on the second line 38 Initialization of the LCD / 2 lines and 5 x 7 matr Table : LCD Commands Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 42 / 109
  • 43. Example Show the interfacing of 16x2 LCD with Microcontroller 8051 and write an assembly language program to display text message โ€œNB BAHADUREโ€. Solution Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 43 / 109
  • 44. Assembly Language Program Method - I ; P2.0 is connected to the RS pin of LCD ; P2.1 is connected to the R/W pin of LCD ; P2.2 is connected to the E pin of LCD ORG 0000H MOV A, #38H ; initialize 16 x 2 LCD ACALL COMMAND ; send command ACALL DELAY ; delay for some time MOV A, #0EH ; display on cursor on ACALL COMMAND ACALL DELAY MOV A, #01H ; clear LCD ACALL COMMAND ACALL DELAY MOV A, #06 ; shift cursor right ACALL COMMAND ACALL DELAY MOV A, #84h ; cursor at line 1, position 4 ACALL COMMAND ACALL DELAY MOV A, #โ€™Nโ€™ ; display letter N ACALL DATA ACALL DELAY Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 44 / 109
  • 45. Assembly Language Program MOV A, #โ€™Bโ€™ ; display letter B ACALL DATA ACALL DELAY MOV A, #โ€™ โ€™ ; display space ACALL DATA ACALL DELAY MOV A, #โ€™Bโ€™ ; display letter B ACALL DATA ACALL DELAY MOV A, #โ€™Aโ€™ ; display letter A ACALL DATA ACALL DELAY MOV A, #โ€™Hโ€™ ; display letter H ACALL DATA ACALL DELAY MOV A, #โ€™Aโ€™ ; display letter A ACALL DATA ACALL DELAY Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 45 / 109
  • 46. Assembly Language Program MOV A, #โ€™Dโ€™ ; display letter D ACALL DATA ACALL DELAY MOV A, #โ€™Uโ€™ ; display letter U ACALL DATA ACALL DELAY MOV A, #โ€™Rโ€™ ; display letter R ACALL DATA ACALL DELAY MOV A, #โ€™Eโ€™ ; display letter E ACALL DATA ACALL DELAY AGAIN: SJMP AGAIN Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 46 / 109
  • 47. Assembly Language Program COMMAND: MOV P1, A CLR P2.0 CLR P2.1 SETB P2.2 ACALL DELAY CLR P2.2 RET DATA: MOV P1,A SETB P2.0 CLR P2.1 SETB P2.2 ACALL DELAY CLR P2.2 RET DELAY: MOV R3, #75H H2: MOV R4,#0FFH H1: DJNZ R4,H1 DJNZ R3,H2 RET Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 47 / 109
  • 48. Assembly Language Program Method - II ; P2.0 is connected to the RS pin of LCD ; P2.1 is connected to the R/W pin of LCD ; P2.2 is connected to the E pin of LCD ORG 0000H MOV DPTR, #COM TAB BACK: CLR A MOVC A, @A+DPTR JZ DATA SEND ACALL COMMAND ACALL DELAY INC DPTR SJMP BACK DATA SEND: MOV DPTR, #DATA TAB BACK1: CLR A MOVC A, @A+DPTR JZ STOP ACALL DATA ACALL DELAY INC DPTR SJMP BACK1 STOP: SJMP STOP Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 48 / 109
  • 49. Assembly Language Program COMMAND: MOV P1, A CLR P2.0 CLR P2.1 SETB P2.2 ACALL DELAY CLR P2.2 RET DATA: MOV P1,A SETB P2.0 CLR P2.1 SETB P2.2 ACALL DELAY CLR P2.2 RET DELAY: MOV R3, #75H H2: MOV R4,#0FFH H1: DJNZ R4,H1 DJNZ R3,H2 RET COM TAB: DB 38H, 01H, 06H, 0EH, 84H, 00H DATA TAB: DB โ€™NB BAHADUREโ€™, 00H END Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 49 / 109
  • 50. Proteus Design Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 50 / 109
  • 51. Stepper Motor Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 51 / 109
  • 52. Introduction to Stepper Motor A stepper motor is widely used device that translate electrical pulses into mechanical movement. In application such as disk drives, dot matrix printers and robotics, the stepper motor is used for position control. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation of input pulses applied. The advantages and disadvantages of stepper motor are given below. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 52 / 109
  • 53. Advantages of Stepper Motor 1 The rotation angle of the motor is proportional to the input pulse. The motor has full torque at stand still (if the winding are energized) Precise positioning and repeatability of movement since good stepper motors. Have an accuracy of 3 -5% of a step and this error is non cumulative from one step to the next. Excellent response to starting stopping reversing. Very reliable since there are no contact brushes in the motor. Therefore the life to the motor is simply dependant on the life of the bearing. The motors response to digital input pulses provides open-loop control, making the motor simpler and less costly to control. It is possible to achieve very low speed synchronous rotation with a load that is directly coupled to the shaft. A wide range of rotational speed is proportional to the frequency of the input pulses. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 53 / 109
  • 54. Disadvantages of Stepper Motor 9 1 Resonance can occur if not properly controlled. Not easy to operate at extremely high speeds. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 54 / 109
  • 55. 2 The stepper motors commonly have a permanent magnet called rotor (also called shaft) surrounded by a stator. There are also stepper motors called variable reluctance stepper motor that do not have permanent magnet rotor. The most common stepper motors have four stator winding that are paired with a center tapped common as shown in figure 8 Figure : Stepper Motor Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 55 / 109
  • 56. Table : Stepping sequence for stepper motor Clockwise โ†“ Step Winding A Winding B Winding C Winding D Counter Clockwise โ†‘ 1 1 0 0 1 2 1 1 0 0 3 0 1 1 0 4 0 0 1 1 It is to be important to note that although we can start with any of the sequence in table 6, once we start we must continue in the proper order. For example if we start with step - 3 we must continue in the sequence of steps 4 - 1 - 2 - 3 - 4 - 1etc. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 56 / 109
  • 57. Stepper Motor Types 1 Active rotor: Permanent Magnet (PM) 2 Reactive rotor: Variable reluctance (VR) 3 Combination of VR and PM: Hybrid (HB) Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 57 / 109
  • 58. Stepper Motor Types I Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 58 / 109
  • 59. Stepper Motor Types II Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 59 / 109
  • 60. Stepper Motor Types III Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 60 / 109
  • 61. Stepper Motor Interfacing Types Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 61 / 109
  • 62. Connecting Unipolar Stepper Motor using L293D Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 62 / 109
  • 63. Connecting Unipolar Stepper Motor using ULN2003A Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 63 / 109
  • 64. Step Sequence 1. Full Step Sequence 2. Half Step Sequence Table : Full Step Sequence Clockwise โ†“ Step A B C D Counter Clockwise โ†‘ 1 ON OFF OFF ON 2 ON ON OFF OFF 3 OFF ON ON OFF 4 OFF OFF ON ON Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 64 / 109
  • 65. Half Step Sequence Table : Half Step Sequence Clockwise โ†“ Step A B C D Counter Clockwise โ†‘ 1 ON ON OFF OFF 2 OFF ON OFF OFF 3 OFF ON ON OFF 4 OFF OFF ON OFF 5 OFF OFF ON ON 6 OFF OFF OFF ON 7 ON OFF OFF ON 8 ON OFF OFF OFF Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 65 / 109
  • 66. Step Angle Step angle = 360 Steps per Revolutions Step angle Steps per revolution 0.72 500 1.8 200 2.0 180 2.5 144 5.0 72 7.5 48 15 24 Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 66 / 109
  • 67. Example Show the interfacing of stepper motor with 8051 Microcontroller and write an assembly language program to rotate stepper motor clockwise continuously. Assume the oscillator frequency of 8051 is 11.0592 MHz. Solution Hardware Arrangement: Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 67 / 109
  • 68. Assembly Language Program Method - I MOV A, #66h ; Load step sequence BACK: MOV P0, A ; Issue sequence to motor RR A ; Rotate right (clockwise pattern) ACALL DELAY ; Wait for some time SJMP BACK ; Keep going DELAY: MOV R7,#04 WAIT2: MOV R6,#0FFH WAIT1: MOV R5,#0FFH WAIT: DJNZ R5,WAIT DJNZ R6,WAIT1 DJNZ R7,WAIT2 RET END Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 68 / 109
  • 69. Assembly Language Program Method - II ORG 0000H STEPPER EQU P0 SJMP MAIN ORG 0030H ; bypass interrupt vector location MAIN: MOV STEPPER, #0CH ACALL DELAY MOV STEPPER, #06H ACALL DELAY MOV STEPPER, #03H ACALL DELAY MOV STEPPER, #09H ACALL DELAY SJMP MAIN Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 69 / 109
  • 70. Assembly Language Program DELAY: MOV R7,#04 WAIT2: MOV R6,#0FFH WAIT1: MOV R5,#0FFH WAIT: DJNZ R5,WAIT DJNZ R6,WAIT1 DJNZ R7,WAIT2 RET END Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 70 / 109
  • 71. Proteus Design Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 71 / 109
  • 72. Example Show the interfacing of stepper motor with 8051 Microcontroller and write an assembly language program to rotate stepper motor clockwise continuously in half step sequence. Assume the oscillator frequency of 8051 is 11.0592 MHz. Solution Hardware Arrangement: Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 72 / 109
  • 73. Assembly Language Program ORG 0000H STEPPER EQU P0 SJMP MAIN ORG 0030H ; bypass interrupt vector location MAIN: MOV STEPPER, #08H ACALL DELAY MOV STEPPER, #0CH ACALL DELAY MOV STEPPER, #04H ACALL DELAY MOV STEPPER, #06H ACALL DELAY MOV STEPPER, #02H ACALL DELAY MOV STEPPER, #03H ACALL DELAY MOV STEPPER, #01H ACALL DELAY MOV STEPPER, #09H ACALL DELAY SJMP MAIN Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 73 / 109
  • 74. Assembly Language Program DELAY: MOV R7,#04 WAIT2: MOV R6,#0FFH WAIT1: MOV R5,#0FFH WAIT: DJNZ R5,WAIT DJNZ R6,WAIT1 DJNZ R7,WAIT2 RET END Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 74 / 109
  • 75. Proteus Design Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 75 / 109
  • 76. Example A switch is connected to port pin P2.0. Write a program to monitor the status of switch and perform the following. (a) If SW = 0 then stepper motor moves clockwise (b) If SW = 1 then stepper motor moves anticlockwise. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 76 / 109
  • 77. Solution Hardware Arrangement: Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 77 / 109
  • 78. Assembly Language Program SETB P2.0 ; Initialize port pin P2.0 as an input port MOV A, #66h MOV P0, A TURN: JB P2.0, CCW RR A MOV P0, A ACALL DELAY SJMP TURN CCW: RL A MOV P0, A ACALL DELAY SJMP TURN DELAY: MOV R7, #04 WAIT2: MOV R6,#0FFH WAIT1: MOV R5,#0FFH WAIT: DJNZ R5,WAIT DJNZ R6,WAIT1 DJNZ R7,WAIT2 RET END Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 78 / 109
  • 79. DAC Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 79 / 109
  • 80. Introduction to DAC Adigital-to-analog converteris a function that converts digital data (usually binary) into ananalog signal(current,voltage, orelectric charge). Ananalog-to-digital converter(ADC) performs the reverse function. Unlike analog signals,digital datacan be transmitted, manipulated, and stored without degradation, albeit with more complex equipment. But a DAC is needed to convert the digital signal to analog to drive an earphone or loudspeaker amplifier in order to produce sound (analog air pressure waves). Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 80 / 109
  • 81. Introduction to DAC... Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 81 / 109
  • 82. Example Show the interfacing of DAC0808 with 8051 microcontroller. Write an ALP to generate a saw tooth wave form (stair step ramp) on port P1. Solution Hardware Arrangement: Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 82 / 109
  • 83. Assembly Language Program CLR A AGAIN: MOV P1, A ; Send data to DAC INC A ; Count from 00 to FF ACALL DELAY ; Let DAC recover SJMP AGAIN Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 83 / 109
  • 84. Example Show the interfacing of DAC0808 with 8051 Microcontroller. Write an ALP to generate a reverse sawtooth wave form (stair step ramp) on port P1. Solution Hardware Arrangement: Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 84 / 109
  • 85. Assembly Language Program MOV A, #0FFh AGAIN: MOV P1, A ; Send data to DAC DEC A ; Count from FF to 00 ACALL DELAY ; Let DAC recover SJMP AGAIN Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 85 / 109
  • 86. Example Show the interfacing of DAC0808 with 8051 microcontroller and write an assembly language program to generate triangular waveform at the DAC output using port P1 of the microcontroller. Generate 200 cycles use P1. Solution Hardware Arrangement: Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 86 / 109
  • 87. Assembly Language Program MOV R2, #200 AGAIN: MOV R3, #0FEH MOV R4, #0FEh CLR A L1: MOV P1, A INC A ACALL DELAY DJNZ R3, L1 MOV A, #0FFh L2: MOV P1, A DEC A ACALL DELAY DJNZ R4, L2 DJNZ R2, AGAIN END Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 87 / 109
  • 88. Example Show the interfacing of DAC 0808 with Microcontroller 8051 and write an assembly language program to generate sine wave continuously on DAC. The values to be sent to the DAC for the generation of sine wave is calculated using the formula given below VOUT = 5V + (5V ร— sin(ฮธ)) Use port P1 of the 8051. Assume oscillator frequency of the 8051 is 11.0592 MHz. The angle ฮธ should be from 0o to 360o in the increment of 15o. Solution To find the values sent to the DAC for various angles we simply multiply Vout by 25.6 because there are 256 steps and full scale Vout is 10V. Therefore 256 steps 10V = 25.6 steps per volts Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 88 / 109
  • 89. Solution Table : Values send to DAC for sine wave generation for example 4 Angle (decimal) sin ฮธ VOUT = 5V + (5V ร— sin(ฮธ)) Values send to DAC = VOUT ร— 25.6 0 0 5 128 15 0.259 6.295 161 30 0.5 7.5 192 45 0.707 8.535 218 60 0.866 9.33 238 75 0.966 9.83 251 90 1 10 256 105 0.966 9.83 251 120 0.866 9.33 238 135 0.707 8.535 218 150 0.5 7.5 192 165 0.259 6.295 161 180 0 5 128 Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 89 / 109
  • 90. Solution Table : Values send to DAC for sine wave generation for example 4 Angle (decimal) sin ฮธ VOUT = 5V + (5V ร— sin(ฮธ)) Values send to DAC = VOUT ร— 25.6 195 -0.259 3.705 94 210 - 0.5 2.5 64 225 -0.707 1.465 37 240 -0.866 0.67 17 255 -0.966 0.17 4 270 -1 0 0 285 -0.966 0.17 4 300 -0.866 0.67 17 315 -0.707 1.465 37 330 -0.5 2.5 64 345 -0.259 3.705 94 360 0 5 128 Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 90 / 109
  • 91. Assembly Language Program REP: MOV DPTR, #SIN TABLE MOV R2, #25 ; for total 25 values from 0 to 360 AGAIN: CLR A MOVC A, @A+DPTR MOV P1, A ACALL DELAY INC DPTR DJNZ R2, AGAIN SJMP REP DELAY: MOV R7, #20H BACK: MOV R6, #0FFH BACK1: MOV R5, #0FFH HERE: DJNZ R5, HERE DJNZ R6, BACK1 DJNZ R7, BACK RET SIN TABLE: DB 128, 161, 192, 218, 238, 251, 256 . 128 END Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 91 / 109
  • 92. ADC Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 92 / 109
  • 93. Introduction to ADC Analog-to-digital converter is a device that converts a continuous physical quantity (usually voltage) to a digital number that represents the quantityโ€™s amplitude. The conversion involves quantization of the input, so it necessar- ily introduces a small amount of error. Instead of doing a single conversion, an ADC often performs the conversions periodically. The result is a sequence of digital values that have converted a continuous-time and continuous- amplitude analog signal to a discrete-time and discrete-amplitude digital signal. The table 11 shows the various analog to digital converters that are most commonly used with the Microcontroller 8051 and family. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 93 / 109
  • 94. Introduction to ADC... Table : Analog to digital converter ICโ€™s Name of the IC Description ADC 0800 8 - bit ADC ADC 0801 8 - bit ADC, 100 ยตs, 0.25 LSB ADC 0802 8 - bit ADC, 100 ยตs, 0.5 LSB ADC 0804 8 - bit ADC, 100 ยตs, 1.0 LSB ADC 0808 8 - bit 8 channel ADC, 100 ยตs ADC 0809 8 - bit 8 channel ADC (equivalent to ADC 0808) AD 571 10 bit, ADC, with reference and clock signals MAX 1204 5V, 8 - channel, serial, 10 bit ADC with 3V digital interface MAX 1202 5V, 8 - channel, serial, 12 bit ADC with 3V digital interface MAX 195 1 6 - bit, self calibrating, 10 ยตs sampling ADC Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 94 / 109
  • 95. Example Show the interfacing of ADC 0804 with Microcontroller 8051 and write an assembly language program to read the value and store in internal memory location 30h. Solution Pin configuration of ADC 0804 Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 95 / 109
  • 96. Solution Hardware Arrangement Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 96 / 109
  • 97. Solution The following points are observed to start the conversion 1 Make chip select (CS) signal low to select the ADC 0804 2 Make write (WR) signal low. 3 Make chip select high 4 Wait for INTR signal to go low, when it goes low, indicates conversion ends. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 97 / 109
  • 98. Solution Once the conversion in ADC is done, the data is available in the output latch of the ADC. Data of new conversion is only available for reading after ADC 0804 made INTR signal low or say when the conversion is completed. Below are the steps observed to read output from the ADC 0804. 1 Make chip select (CS) pin low. 2 Make read (RD) signal low. 3 Read the data from port where ADC is connected. 4 Make read (RD) signal high. 5 Make chip select (CS) high. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 98 / 109
  • 99. Assembly Language Program RD EQU P1.0 ; Read signal P1.0 WR EQU P1.1 ; Write signal P1.1 CS EQU P1.2 ; Chip select signal P1.2 INTR EQU P1.3 ; INTR signal P1.3 ADC PORT EQU P2 ; ADC data port pin P2 ORG 0000h START: ACALL CONV ; Start ADC Conversion ACALL READ ; Read converted value MOV P3, 30h ; Move the value to the port P3 SJMP START ; repeat the process CONV: CLR CS ; make CS low CLR WR ; make WR low NOP ; give small delay SETB WR ; make WR high SETB CS ; make CS high WAIT: JB INTR, WAIT ; Wait for INTR signal RET ; Conversion completed Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 99 / 109
  • 100. Assembly Language Program READ: CLR CS ; make CS low CLR RD ; make RD low MOV A, ADC PORT ; Read the converted value MOV 30h, A ; Store the converted value in internal RAM 30h SETB RD ; make RD high SETB CS ; Make CS high RET ; Reading completed Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 100 / 109
  • 101. Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 101 / 109
  • 102. Introduction to Keyboard Keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and columns through ports therefore with two 8 bit ports an 8 x 8 matrix of keys can be connected to the Microcontroller. When a key is pressed, a row and a column make a contact; otherwise there is no connection between rows and column. Scanning and identification of the key: Figure shows a 4 x 4 matrix keyboard connected to two ports. The rows are connected to the output port and the columns are connected to the input port. If no key has been pressed, reading the input port will yield 1s for all columns. Since they are all connected to the high (Vcc). If all the rows are grounded and a key is pressed one of the column will have 0 since the key is pressed provides the path to ground. If the function of the Microcontroller to scan the keyboard continuously to detect and identify the key pressed. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 102 / 109
  • 103. Introduction to Keyboard... Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 103 / 109
  • 104. Introduction to Keyboard... Grounding rows and reading the column: To detect a pressed key, the Microcontroller grounds all rows by providing 0 to the output latch then it reads the column. If the data read from the column is D3 - D0 = 1111, no key has been pressed and process continuous until a key pressed is detected. However, if one of the column bit has a zero, this means that a key has occurred. For ex: if D3 - D0 = 1101, this means that a key in D1 column has been pressed. After a key press is detected, the Microcontroller will go through the process of identifying the key. Starting with the top row, the Microcontroller grounds it by providing a low to row D0 only; then it reads the column. If the data read is all 1โ€™s, no key in that row is activated and the process is moved to the next row. It grounds the next row, reads the column and check for any zero. This process continuous until the row is identified. After identification if the row in which the key has been pressed, the next task is to find out which column the pressed key belongs to. This should be easy since Microcontroller knows at any time which row and column are being occurred. Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 104 / 109
  • 105. Example Interface 4 x 4 matrix keyboards with Microcontroller 8051. Write an ALP to read the keypad and send the ASCII code of pressed key to port P0. P1.0 - P1.3 connected to rows (Output) P2.0 - P 2.3 connected to the column (Input) Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 105 / 109
  • 106. Assembly Language Program MOV P2, #0FFh ; P2 input K1: MOV P1, #00h ; Grounds all rows at once MOV A, P2 ; Reads column ensure all key open ANL A, #0Fh ; mask unused bits CJNE A, #0Fh, K1 ; check till all keys are released ACALL DELAY ; 20ms DELAY K2: MOV A, P2 ; SEE ANY KEY PRESSED ANL A, #0F CJNE A, #0F, OVER SJMP K2 OVER: ACALL DELAY MOV A, P2 ANL A, #0F CJNE A, #0F, OVER1 ; Key pressed find row SJMP K2 ; if none keep poling OVER1: MOV P1, #11111110B ; GROUND ROW 0 MOV A, P2 ANL A, #0F CJNE A, #0F, ROW 0 MOV P1, #11111101B ; GROUND ROW 1 Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 106 / 109
  • 107. Assembly Language Program MOV A, P2 ANL A, #0F CJNE A, #0F, ROW 1 MOV P1, #11111011B ; GROUND ROW 2 MOV A, P2 ANL A, #0F CJNE A, #0F, ROW 2 MOV P1, #11110111B ; GROUND ROW 3 MOV A, P2 ANL A, #0F CJNE A, #0F, ROW 3 LJMP K2 ; IF NONE FALSE INPUT, REPEAT ROW 0: MOV DPTR, #KCODE0 SJMP FIND ROW 1: MOV DPTR, #KCODE1 SJMP FIND ROW 2: MOV DPTR, #KCODE2 SJMP FIND ROW 3: MOV DPTR, #KCODE3 SJMP FIND Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 107 / 109
  • 108. Assembly Language Program FIND: RRC A ; See if any CY bit is low JNC ASC ; if zero get ASCII code INC DPTR SJMP FIND ; Suppose A= 11111110 it means column 0 is detected so send ASCII ASC: CLR A MOVC A, @A+DPTR MOV P0, A LJMP K1 ; ASCII Look up table for each row KCODE0: DB โ€™0โ€™, โ€™1โ€™, โ€™2โ€™, โ€™3โ€™ ; row 0 KCODE1: DB โ€™4โ€™, โ€™5โ€™, โ€™6โ€™, โ€™7โ€™ ; row 1 KCODE2: DB โ€™8โ€™, โ€™9โ€™, โ€™Aโ€™ ,โ€™Bโ€™ ; row 2 KCODE3: DB โ€™Cโ€™, โ€™Dโ€™, โ€™Eโ€™, โ€™Fโ€™ ; row 3 Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 108 / 109
  • 109. Thank you Please send your feedback at nbahadure@gmail.com For more details and updates kindly visit https://sites.google.com/site/nileshbbahadure/home Main Slide Dr. Nilesh Bhaskarrao Bahadure () Unit - IV (Part I) July 25, 2021 109 / 109