SlideShare a Scribd company logo
Dr. C. SARITHA
DEPT. OF ELECTRONICS
UNIT IV
Applications of Embedded Systems
Temperature Measurement :
Transducers convert physical data such as temperature, light intensity, flow and speed
to electrical signals. Depending on the transducer, the output produced is in the form of voltage,
current, resistance or capacitance. For example, temperature is converted to electrical signals using
a transducer called a thermistor. A thermisor responds to temperature change by changing
resistance, but its response is not linear. So, writing the software for such nonlinear devices is
difficult. To overcome this difficultly many manufacturers released linear temperature sensors
include LM34 and LM35 series from National Semiconductors.
LM35 Sensor :
The LM series sensors are precision integrated circuit temperature sensors whose output
voltage is linearly proportional to the Celsius (centigrade) temperature. The LM35 requires no
external calibration since it is inherently calibrated. It outputs 10mV for each degree of centigrade
temperature. Its temperature range is -55C to +150C.
Signal Conditioning and Interfacing the LM35 to 8051:
Signal conditioning is widely used term in the world of data acquisition. The most
common transducers produce an output in the form of voltage, current, charge, capacitance, and
resistance. However, we need to convert these signals to voltage in order to send input to an A to
D converter. This conversion is commonly called signal conditioning. Signal conditioning can be a
current to voltage conversion or a signal amplification. For example, the thermistor changes
resistance with temperature. The change of resistance must be translated into voltages in order to
use to an ADC. Now, consider the case of connecting an LM35 to an ADC 0809. Since, ADC0809
has 8-bit resolution with a maximum of 256 (28
) steps and the LM35 produces 10mV for every
degree of temperature change, we need to set Vref(+) = 2.56V of the ADC 0809 to produce a Vout
of 2560mV (2.56V).
1
Dr. C. SARITHA
DEPT. OF ELECTRONICS
Interfacing diagram of LM35 with 8051:
As shown in the diagram Port 1 of 8051 microcontroller is connected to the data lines of
ADC0809. The address lines C, B, and A are grounded. So, Channel 0 is selected to apply the
analog input. To deactivate the remaining channels, they are grounded. Here, Vref (+) is supplied
with 2.56V, to get a 10mV step size. Vcc and OE are connected to +5V. Vref (-) and GND pins
are connected to ground. CLK must be applied to the 10th
pin of ADC by using a clock source.
SOC line is used to start the conversion and ALE line is used to latch the address. To start the
conversion and latch the address make these lines high through the microcontroller. Then
conversion begins. After some time EOC line becomes high, to indicate the conversion is
completed and the equivalent digital word is at Port 1. The timing diagram shows the entire
procedure of analog to digital conversion.
Fig(i): Timing diagram for ADC 0809
2
Dr. C. SARITHA
DEPT. OF ELECTRONICS
Program:
START: SETB P3.4 ; Set SOC = 1, ALE = 1
ACALL DELAY ; Call for the delay
CLR P3.4 ; Clear SOC and ALE
HERE: JNB P3.5, HERE ; Check, for EOC = 1
MOV A, P1 ; Move the data from Port 1 to A
SJMP START ; Continue the same
Result :
Temperature in o
C Vin (mV) Digital output in Hex
0
1
2
3
10
30
0
10
20
30
100
300
00
01
02
03
0A
1E
Displaying of Information on LCD:
In LCD, liquid crystal solution is sandwiched by two sheets for polarizing material. LCD is
used to display the status information or to display prompts to the user. The display can be as
small as 1 line with 8 characters. Other displays used in embedded systems can be of 6.4 inch
or 8.4 inch etc. The diagonal distance is indicated as display size. .
Advantages :
• Less cost
• Small size
• Ability to display numbers, characters and graphics
• Incorporation of a refreshing controller into the LCD, reduces the work of CPU
• Ease of programming for characters and graphics
3
Dr. C. SARITHA
DEPT. OF ELECTRONICS
LCD pin descriptions :
Pin
Numbe
r
Symbol Description
1 VSS Ground
2 VCC +5V power supply
3 VEE Power supply to control contrast
4 RS RS=0 to select command register
RS=1 to select data register
5 R/W R/W=0 for write, R/W=1 for read
6 EN Enable
7 D0 8-bit data bus
8 D1 8-bit data bus
9 D2 8-bit data bus
10 D3 8-bit data bus
11 D4 8-bit data bus
12 D5 8-bit data bus
13 D6 8-bit data bus
14 D7 8-bit data bus
RS (Register Select):
There are two very important registers inside the LCD. If RS=0, the command register is
selected, allowing the user to send a command. If RS=1, the data register is selected, allowing the
user to send a data to be displayed on the LCD.
R/W (Read/Write) :
R/W input allows the user to write information to the LCD or read information from it.
R/W =1 when reading, R/W=0 when writing.
EN (Enable) :
The enable pin is used by the LCD to latch information presented to its data pins. To
latch the data from the data pins, a high to low pulse must be applied to this pin.
D0-D7 (Data pins):
The 8 bit data pins, D0-D7, are used to send information to the LCD or read the contents of
the LCD’s internal registers. To display letters and numbers, we send ASCII codes for the letters
4
Dr. C. SARITHA
DEPT. OF ELECTRONICS
A – Z, a – z, and numbers 0 – 9 to these pins while making RS=1. There are also commands that
can be sent to the LCD to clear the display or force the cursor to the home position or blink the
cursor when RS=0.
LCD Commands :
Code in Hex Command to LCD
01 Clear display
02 Return home
04 Decrement cursor
06 Increment cursor
05 Shift display right
07 Shift display left
0E Display on, Cursor blinking
80 Force cursor to beginning of 1st
line
C0 Force cursor to beginning of 2nd
line
38 Initialize the LCD display
Interfacing the LCD display to 8051:
In the above circuit diagram a 2x16 line LCD display is connected to the 8051
microcontroller. First, Port 1 lines of 8051 are connected to the D0-D7 lines of the LCD. Then,
three lines of Port 2 i.e., P2.0, P2.1 and P2.2 are connected to RS, R/W and EN pins of the LCD
respectively. The Vcc line is supplied with +5V and Vss is connected to ground. The VEE line is
used to adjust the contrast of the LCD by connecting a +5V supply through a 10KΩ Potentiometer.
Program to display a message on LCD :
MOV A, #38H ; Initialize the LCD display
ACALL CMDWRT ; Call command subroutine
5
Dr. C. SARITHA
DEPT. OF ELECTRONICS
ACALL DELAY ; Call delay
MOV A, #0EH ; display on, cursor on
ACALL CMDWRT ; Call command subroutine
ACALL DELAY ; Call delay
MOV A, #01H ; Clear LCD
ACALL CMDWRT ; Call command subroutine
ACALL DELAY ; Call delay
MOV A, #06H ; Shift cursor right
ACALL CMDWRT ; Call command subroutine
ACALL DELAY ; Call delay
MOV A, #80H ; Cursor at line1
ACALL CMDWRT ; Call command subroutine
ACALL DELAY ; Call delay
MOV A, #’L’ ; Display letter L
ACALL DATWRT ; Call data subroutine
ACALL DELAY ; Call delay
MOV A, #’C’ ; Display letter C
ACALL DATWRT ; Call data subroutine
ACALL DELAY ; Call delay
MOV A, #’D’ ; Display letter D
ACALL DATWRT ; Call data subroutine
AGAIN: SJMP AGAIN ; Stay here
CMDWRT: ; Send command to LCD
MOV P1, A ; Copy the contents of register A to Port 1
CLR P2.0 ; RS=0 for command register
CLR P2.1 ; R/W=0 for write operation
SETB P2.2 ; E=1 for high pulse
CLR P2.2 ; E=0 for H-to-L pulse
RET ; Return to main program
DATWRT: ; Send data to LCD
MOV P1, A ; Copy the contents of register A to Port 1
SETB P2.0 ; RS=1 for data register
CLR P2.1 ; R/W=0 for write operation
SETB P2.2 ; E=1 for high pulse
6
Dr. C. SARITHA
DEPT. OF ELECTRONICS
CLR P2.2 ; E=0 for H-to-L pulse
RET ; Return to main program
DELAY: MOV R3, #50H ; Set R3=50H
LOOP: MOV R4, #0FFH ; Set R4=0FFH
LOOP1: DJNZ R4, LOOP ; Decrement R4, till it becomes zero
DJNZ R3, LOOP1 ; Decrement R3, till it becomes zero
RET ; Return to main program
Control of Stepper motor :
A stepper motor is a widely used device that translates electrical pulses into mechanical
movement. In applications such as disk drives, dot matrix printers and robotics, the stepper motor
is used for position control. Every stepper motor has a permanent magnet rotor (also called the
shaft) surrounded by a stator. The most common stepper motors have four stator windings that are
paired with a center-tapped common as shown in fig (a).
Fig (a): Stator windings configuration
This type of stepper motor is commonly referred to as a four phase stepper motor. The center tap
allows a change of current direction in each of two coils when a winding is grounded, thereby
resulting in a polarity change of the stator. Notice that while a conventional motor shaft runs
freely, the stepper motor shaft moves in a fixed repeatable increment which allows one to move it
to a precise position. This repeatable fixed movement is possible as a result of basic magnetic
theory where poles of the same polarity repel and opposite poles attract. The direction of the
rotation is dictated by the stator poles. The stator poles are determined by the current sent through
the wire coils. As the direction of the current is changed, the polarity is also changed causing the
reverse motion of the rotor.
The stepper used here has a total of 6 leads : 4 leads representing the four stator
winding and 2 commons for the center tapped leads. As the sequence of power is applied to each
stator winding, the rotor will rotate. There are several widely used sequences where each has a
different degree of precision. Table 1 shows the normal 4 step sequence.
Table 1 : Normal 4-step sequence
7
Dr. C. SARITHA
DEPT. OF ELECTRONICS
Clockwise Step Winding A Winding B Winding C Winding D Counter
clockwise1 1 0 0 1
2 1 1 0 0
3 0 1 1 0
4 0 0 1 1
It must be noted that although we can start with any of the sequences, once we start we
must continue in the proper order.
Step angle : The step angle is the minimum degree of rotation associated with a single step.
Various motors have different step angles
Steps per revolution : This is the total number of steps needed to rotate one complete rotation or
3600
(Ex: 1.8 degrees x 200 steps = 360 degrees).
Motor speed : The motor speed is measured in steps per second, is a function of the switching
rate. We know that Steps per second = (RPM x Steps per revolution)/60. Notice that, by changing
the length of the time delay, we can get various rotation speeds.
Interfacing diagram for Stepper motor :
In the above diagram, the four leads of the stator winding are connected to the four bits
of the 8051 port i.e., P1.0, P1.1, P1.2 and P1.3 respectively. These four bits will control the motor.
However, since the 8051 lacks sufficient current to drive the stepper motor windings, we must use a
driver such as the ULN2003 to energize the stator. The common wires are connected the positive
side of the motors power supply. In many motors +5V is sufficient. By applying proper sequence
to the stator windings, we can rotate the motor in both clockwise and anti-clockwise directions.
8
Dr. C. SARITHA
DEPT. OF ELECTRONICS
Program to rotate a stepper motor in clock wise direction:
MOV A, #66H ; Load step sequence
BACK: MOV P1, A ; Issue sequence to motor through Port 1
RR A ; Rotate right, clockwise by one step
ACALL DELAY ; wait
SJMP BACK ; Repeat the same
DELAY: MOV R3, #50H ; Set R3=50H
LOOP: MOV R4, #0FFH ; Set R4=0FFH
LOOP1: DJNZ R4, LOOP ; Decrement R4, till it becomes zero
DJNZ R3, LOOP1 ; Decrement R3, till it becomes zero
RET ; Return to main program
Program to rotate a stepper motor in anti-clock wise direction:
MOV A, #66H ; Load step sequence
BACK: MOV P1, A ; Issue sequence to motor through Port 1
RL A ; Rotate left, anti-clockwise by one step
ACALL DELAY ; wait
SJMP BACK ; Repeat the same
DELAY: MOV R3, #50H ; Set R3=50H
LOOP: MOV R4, #0FFH ; Set R4=0FFH
LOOP1: DJNZ R4, LOOP ; Decrement R4, till it becomes zero
DJNZ R3, LOOP1 ; Decrement R3, till it becomes zero
RET ; Return to main program
Note : To increase the speed of the motor, keep R3 value less or to decrease the speed of the motor
keep R3 value high.
Keyboard Interfacing to the 8051:
Keyboards are the most widely used input device. These keyboards are organized in a
matrix of rows and columns through ports, therefore, with two 8-bit ports, an 8x8 matrix of keys
can be connected to a microcontroller. When a key is pressed, a row and a column make a contact,
otherwise, there is no connection between rows and columns.
Fig (a) shows a 4x4 matrix connected to two ports. The rows are connected to an
output port and the columns are connected to an input port. If no key has been pressed, reading the
9
Dr. C. SARITHA
DEPT. OF ELECTRONICS
input port will yield 1s for all columns since they are all connected to high (Vcc). If all the rows are
grounded and a key is pressed, one of the columns will have 0 since the key pressed provides the
path to ground. It is the function of the microcontroller to scan the keyboard continuously to detect
and identify the key pressed.
Fig (a) : Matrix keyboard connection to ports
Grounding rows and reading columns :
To detect a pressed key, the microcontroller grounds all rows by providing 0 to the
output latch, then it reads the columns. If the data read from the columns is D3-D0 = 1111, no key
has been pressed and the process continues until a key press is detected. However, if one of the
column bits has a zero, this means that a key press has occurred. For example, if D3-D0 = 1101,
this means that a key in the 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 columns. If the data
read is all 1s, no key in that row is activated and the process is moved to the next row. It grounds
the next row, reads the columns, and checks for any zero. This process continues until the row is
identified. After identification of 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 the microcontroller knows
at any time which row and column are being accessed.
Program:
This program sends the ASCII code for pressed key to Port 0
MOV P2, #0FFH ; Make P2 an input port
K1: MOV P1, #00H ; Ground all rows at once
MOV A, P2 ; Read all columns
10
Dr. C. SARITHA
DEPT. OF ELECTRONICS
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, K1 ; Check till all keys released
K2: ACALL DELAY ; Call 20 msec delay
MOV A, P2 ; See if any key is pressed
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, OVER ; Key pressed, await closure
SJMP K2 ; Check if key is pressed
OVER: ACALL DELAY ; Wait 20 msec debounce time
MOV A, P2 ; Check key closure
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, OVER1 ; Key pressed, find row
SJMP K2 ; If none, keep polling
OVER1: MOV P1, #11111110B ; Ground row 0
MOV A, P2 ; Read all columns
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, ROW_0 ; Key pressed in row 0, find the column
MOV P1, #11111101B ; Ground row 1
MOV A, P2 ; Read all columns
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, ROW_1 ; Key pressed in row 1, find the column
MOV P1, #11111011B ; Ground row 2
MOV A, P2 ; Read all columns
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, ROW_2 ; Key pressed in row 2, find the column
MOV P1, #11110111B ; Ground row 3
MOV A, P2 ; Read all columns
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, ROW_3 ; Key pressed in row 3, find the column
LJMP K2 ; If none, false input, repeat
ROW_0: MOV DPTR, #KCODE0 ; Set DPTR=start of row 0
SJMP FIND ; Find column key belongs to
ROW_1: MOV DPTR, #KCODE1 ; Set DPTR=start of row 1
SJMP FIND ; Find column key belongs to
ROW_2: MOV DPTR, #KCODE2 ; Set DPTR=start of row 2
11
Dr. C. SARITHA
DEPT. OF ELECTRONICS
SJMP FIND ; Find column key belongs to
ROW_3: MOV DPTR, #KCODE3 ; Set DPTR=start of row 3
SJMP FIND ; Find column key belongs to
FIND: RRC A ; See if any carry bit low
JNC MATCH ; If zero, get the ASCII code
INC DPTR ; Point to next column address
SJMP FIND ; Keep searching
MATCH: CLR A ; Set A=0 (Match is found)
MOVC A, @A+DPTR ; Get ASCII code from table
MOV P0, A ; Display pressed key
LJMP K1 ; Repeat the same for next key press
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
Waveform generation using DAC0800 :
Digital to analog converters are used to convert digital quantity to analog quantity. D/A
converter produces an output proportional to the digital quantity (binary word) applied to its input.
A most widely used DAC chip is DAC 0800. This chip is also used to generate different
waveforms.
Features of DAC0800:
• It is an 8-bit DAC
• It has fast settling time : 100ns
• The conversion technique used is R-2R ladder network method
• It operates at +4.5V to +18V supply
• Low cost
• Full scale error: ±1 LSB
• Low power consumption
Interfacing diagram of DAC with 8051:
12
Dr. C. SARITHA
DEPT. OF ELECTRONICS
As shown in the diagram Port 1of 8051 microcontroller is connected to the data lines of
DAC. The supply V+
is connected to the +5V or +12V. V-
is connected to the -12V. The DAC
0800 is a current output device. So, an op-amp is used, to convert the output of DAC i.e., current to
voltage. One of the applications of an op amp is as a current to voltage converter. The output of
the op amp is connected to a CRO, in which the corresponding wave form will appear, depending
the assembly language program.
Program to generate Square wave:
HERE: MOV A, #0FFH ; Load A=0FFH
MOV P1, A ; Sent FFH to Port 1
LACLL DELAY ; Call delay subroutine
MOV A, #00H ; Load A=00H
MOV P1, A ; Sent 00H to Port 1
LCALL DELAY ; Call delay subroutine
SJMP HERE ; Go to label HERE
DELAY: MOV R3, #0FFH ; Load R3 with FFH
LOOP: DJNZ R3, LOOP ; Decrement R3 by1 and if R3≠0 go to label LOOP
RET ; Return to main program
Program to generate Rectangular wave:
13
Dr. C. SARITHA
DEPT. OF ELECTRONICS
HERE: MOV A, #0FFH ; Load A=FFH
MOV P1, A ; Sent FFH to Port 1
LACLL DELAY1 ; Call larger delay subroutine
MOV A, #00H ; Load A=00H
MOV P1, A ; Sent 00H to Port 1
LCALL DELAY2 ; Call smaller delay subroutine
SJMP HERE ; Go to label HERE
DELAY1: MOV R5, #0FF ; Load R5 with FFh
LOOP: MOV R6, #0FF ; Load R6 with FFh
HERE: DJNZ R6, HERE ; Decrement R6 by1 and if R6≠0 go to label HERE
DJNZ R5, LOOP ; Decrement R5 by1 and if R5≠0 go to label LOOP
RET ; Return to main program
DELAY2: MOV R3, #0FF ; Load R3 with FFh
LOOP: DJNZ R3, LOOP ; Decrement R3 by1 and if R3≠0 go to label LOOP
RET ; Return to main program
Program to generate sawtooth wave:
MOV A, #00H ; Load A=00h
BACK: MOV P1, A ; Sent the value of A to Port1
INC A ; Increment the value of A by 1
SJMP BACK ; Repeat the same
Program to generate Triangular wave:
BACK: MOV A, #00H ; Load A=00h
14
Dr. C. SARITHA
DEPT. OF ELECTRONICS
INCR: MOV P1, A ; Sent the value of A to Port1
INC A ; Increment the value of A by 1
CJNE A, #0FF, INCR ; Compare if A=0FFH, if not, goto label INCR
DECR: MOV P1,A ; Sent the value of A to Port1
DEC A ; Decrement the value of A by 1
CJNE A, #00, DECR ; Compare if A=00H, if not, goto label DECR
SJMP BACK ; Repeat the same
Program to generate Step wave:
BACK: MOV A, #00H ; Load A=00h
MOV P1, A ; Sent the value of A to Port1
ACALL DELAY ; Call delay subroutine
LOOP: ADD A, #33H ; Add the data 33H to the contents of A
MOV P1, A ; Sent the value of A to Port 1
ACALL DELAY ; Call delay subroutine
CJNE A, #0FFH, LOOP ; Compare if A=0FFH, if not, goto label LOOP
SJMP BACK ; Repeat the same
Program to generate Sine wave:
AGAIN: MOV DPTR, #TABLE ; Load DPTR with the address of TABLE
MOV R2, #COUNT ; Load R2 with count
BACK: CLR A ; Clear Accumulator i.e., A=00
MOVC A,@A+DPTR ; Go to the look up table for getting the value
MOV P1, A ; Move the lookup table value to Port 1
15
Dr. C. SARITHA
DEPT. OF ELECTRONICS
INC DPTR ; Increment DPTR by 1
DJNZ R2, BACK ; Decrement R2 by1 and if R2≠0 go to label LOOP
SJMP AGAIN ; Repeat the same
TABLE: DB 128, 192, 238, 255, 238, 192 ; Sine wave for 300
DB 128, 64, 17, 0, 17, 64, 128
16
ALL THE
BEST

More Related Content

What's hot

8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
Stefan Oprea
 
8085 micro processor
8085 micro processor8085 micro processor
8085 micro processor
Poojith Chowdhary
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
deval patel
 
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction set
Shail Modi
 
8051 Addressing Modes
8051 Addressing Modes8051 Addressing Modes
8051 Addressing Modes
Senthil Kumar
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
Saumitra Rukmangad
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)
Basil John
 
8085 paper-presentation
8085 paper-presentation8085 paper-presentation
8085 paper-presentation
JiMs ChAcko
 
8051 basic programming
8051 basic programming8051 basic programming
8051 basic programming
ANJUSHA R
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1
deval patel
 
8051 micro controllers Instruction set
8051 micro controllers Instruction set 8051 micro controllers Instruction set
8051 micro controllers Instruction set
Nitin Ahire
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085
ShivamSood22
 
Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontroller
bhadresh savani
 
Chapter 8
Chapter 8Chapter 8
Chapter 8
deval patel
 
1347 Assembly Language Programming Of 8051
1347 Assembly Language Programming Of 80511347 Assembly Language Programming Of 8051
1347 Assembly Language Programming Of 8051
techbed
 
8051 assembly programming
8051 assembly programming8051 assembly programming
8051 assembly programming
sergeiseq
 
The 8051 assembly language
The 8051 assembly languageThe 8051 assembly language
The 8051 assembly languagehemant meena
 

What's hot (20)

8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
8085 micro processor
8085 micro processor8085 micro processor
8085 micro processor
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction set
 
8051 Addressing Modes
8051 Addressing Modes8051 Addressing Modes
8051 Addressing Modes
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
8085 paper-presentation
8085 paper-presentation8085 paper-presentation
8085 paper-presentation
 
8051 basic programming
8051 basic programming8051 basic programming
8051 basic programming
 
mup
mupmup
mup
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1
 
8051 micro controllers Instruction set
8051 micro controllers Instruction set 8051 micro controllers Instruction set
8051 micro controllers Instruction set
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085
 
8085
80858085
8085
 
Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontroller
 
Chapter 8
Chapter 8Chapter 8
Chapter 8
 
1347 Assembly Language Programming Of 8051
1347 Assembly Language Programming Of 80511347 Assembly Language Programming Of 8051
1347 Assembly Language Programming Of 8051
 
8051 assembly programming
8051 assembly programming8051 assembly programming
8051 assembly programming
 
The 8051 assembly language
The 8051 assembly languageThe 8051 assembly language
The 8051 assembly language
 

Similar to Unit iv microcontrollers final

UNIT 4 & 5 - I nterfacing_Lecture7.pptx
UNIT 4 & 5 - I         nterfacing_Lecture7.pptxUNIT 4 & 5 - I         nterfacing_Lecture7.pptx
UNIT 4 & 5 - I nterfacing_Lecture7.pptx
naveen088888
 
Adc and dac
Adc and dacAdc and dac
Adc and dac
nitugatkal
 
project - Copy
project - Copyproject - Copy
project - Copypiedaholic
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
KanchanPatil34
 
8051interfacing 190425062221
8051interfacing 1904250622218051interfacing 190425062221
8051interfacing 190425062221
Indranil Hatai
 
Unit iii microcontrollers final1
Unit iii microcontrollers final1Unit iii microcontrollers final1
Unit iii microcontrollers final1
Saritha Reddy
 
Distance Protection
Distance ProtectionDistance Protection
Distance Protection
ncct
 
Pic ppt 13104022(4th_year)
Pic ppt 13104022(4th_year)Pic ppt 13104022(4th_year)
Pic ppt 13104022(4th_year)
Daman Singh
 
Analog to Digital Converters
Analog to Digital ConvertersAnalog to Digital Converters
Analog to Digital Converters
Amitabh Shukla
 
MPC of TWT based Transmitter
MPC of TWT based TransmitterMPC of TWT based Transmitter
MPC of TWT based TransmitterAbhishek Sutrave
 
analog to digital converter and dac final
analog to digital converter and dac finalanalog to digital converter and dac final
analog to digital converter and dac final
DrVikasMahor
 
Digital Alarm Clock (IC-TMS-8560)
Digital Alarm Clock (IC-TMS-8560)Digital Alarm Clock (IC-TMS-8560)
Digital Alarm Clock (IC-TMS-8560)Chintan Patel
 
Interfacing technique with 8085- ADC[0808]
Interfacing technique with 8085- ADC[0808]Interfacing technique with 8085- ADC[0808]
Interfacing technique with 8085- ADC[0808]
Guhan k
 
Microprocessor based Temperature Controller
Microprocessor based Temperature ControllerMicroprocessor based Temperature Controller
Microprocessor based Temperature Controller
Revanth Reddy
 
Construction of digital voltmeter by Bapi Kumar Das
Construction of digital voltmeter by Bapi Kumar DasConstruction of digital voltmeter by Bapi Kumar Das
Construction of digital voltmeter by Bapi Kumar Das
B.k. Das
 
adcanddac hai kya bhayy me know if-01.pptx
adcanddac hai kya bhayy me know if-01.pptxadcanddac hai kya bhayy me know if-01.pptx
adcanddac hai kya bhayy me know if-01.pptx
shivraj3252
 
LCD WITH 8051.docx
LCD WITH 8051.docxLCD WITH 8051.docx
LCD WITH 8051.docx
bhattparthiv23
 

Similar to Unit iv microcontrollers final (20)

UNIT 4 & 5 - I nterfacing_Lecture7.pptx
UNIT 4 & 5 - I         nterfacing_Lecture7.pptxUNIT 4 & 5 - I         nterfacing_Lecture7.pptx
UNIT 4 & 5 - I nterfacing_Lecture7.pptx
 
Chapter5 dek3133
Chapter5 dek3133Chapter5 dek3133
Chapter5 dek3133
 
Adc and dac
Adc and dacAdc and dac
Adc and dac
 
project - Copy
project - Copyproject - Copy
project - Copy
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
 
8051interfacing 190425062221
8051interfacing 1904250622218051interfacing 190425062221
8051interfacing 190425062221
 
Unit iii microcontrollers final1
Unit iii microcontrollers final1Unit iii microcontrollers final1
Unit iii microcontrollers final1
 
Distance Protection
Distance ProtectionDistance Protection
Distance Protection
 
Pic ppt 13104022(4th_year)
Pic ppt 13104022(4th_year)Pic ppt 13104022(4th_year)
Pic ppt 13104022(4th_year)
 
Analog to Digital Converters
Analog to Digital ConvertersAnalog to Digital Converters
Analog to Digital Converters
 
8255
82558255
8255
 
MPC of TWT based Transmitter
MPC of TWT based TransmitterMPC of TWT based Transmitter
MPC of TWT based Transmitter
 
analog to digital converter and dac final
analog to digital converter and dac finalanalog to digital converter and dac final
analog to digital converter and dac final
 
Digital Alarm Clock (IC-TMS-8560)
Digital Alarm Clock (IC-TMS-8560)Digital Alarm Clock (IC-TMS-8560)
Digital Alarm Clock (IC-TMS-8560)
 
Interfacing technique with 8085- ADC[0808]
Interfacing technique with 8085- ADC[0808]Interfacing technique with 8085- ADC[0808]
Interfacing technique with 8085- ADC[0808]
 
Microprocessor based Temperature Controller
Microprocessor based Temperature ControllerMicroprocessor based Temperature Controller
Microprocessor based Temperature Controller
 
Construction of digital voltmeter by Bapi Kumar Das
Construction of digital voltmeter by Bapi Kumar DasConstruction of digital voltmeter by Bapi Kumar Das
Construction of digital voltmeter by Bapi Kumar Das
 
8051 FINIAL
8051 FINIAL8051 FINIAL
8051 FINIAL
 
adcanddac hai kya bhayy me know if-01.pptx
adcanddac hai kya bhayy me know if-01.pptxadcanddac hai kya bhayy me know if-01.pptx
adcanddac hai kya bhayy me know if-01.pptx
 
LCD WITH 8051.docx
LCD WITH 8051.docxLCD WITH 8051.docx
LCD WITH 8051.docx
 

More from SARITHA REDDY

Introduction to microprocessors notes
Introduction to microprocessors notesIntroduction to microprocessors notes
Introduction to microprocessors notes
SARITHA REDDY
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
SARITHA REDDY
 
Introduction to microprocessor notes
Introduction to microprocessor notesIntroduction to microprocessor notes
Introduction to microprocessor notes
SARITHA REDDY
 
Decimation in time and frequency
Decimation in time and frequencyDecimation in time and frequency
Decimation in time and frequency
SARITHA REDDY
 
RT linux
RT linuxRT linux
RT linux
SARITHA REDDY
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
SARITHA REDDY
 
I o ports and timers of 8051
I o ports and timers of 8051I o ports and timers of 8051
I o ports and timers of 8051SARITHA REDDY
 
Mos and cmos technology
Mos and cmos technologyMos and cmos technology
Mos and cmos technology
SARITHA REDDY
 
Logic families
Logic familiesLogic families
Logic families
SARITHA REDDY
 
Clampers and clippers
Clampers and clippersClampers and clippers
Clampers and clippers
SARITHA REDDY
 
Linked lists
Linked listsLinked lists
Linked lists
SARITHA REDDY
 
Arrays
ArraysArrays
Electro Magnetic Wave Propagation
Electro Magnetic Wave PropagationElectro Magnetic Wave Propagation
Electro Magnetic Wave Propagation
SARITHA REDDY
 
Satellite communications
Satellite communicationsSatellite communications
Satellite communications
SARITHA REDDY
 
Electronics in daily life
Electronics in daily lifeElectronics in daily life
Electronics in daily life
SARITHA REDDY
 
BSc I year practicals
BSc I year practicalsBSc I year practicals
BSc I year practicals
SARITHA REDDY
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
SARITHA REDDY
 
Applications of op amps
Applications of op ampsApplications of op amps
Applications of op amps
SARITHA REDDY
 
Digital logic gates and Boolean algebra
Digital logic gates and Boolean algebraDigital logic gates and Boolean algebra
Digital logic gates and Boolean algebra
SARITHA REDDY
 
Graphs in c language
Graphs in c languageGraphs in c language
Graphs in c language
SARITHA REDDY
 

More from SARITHA REDDY (20)

Introduction to microprocessors notes
Introduction to microprocessors notesIntroduction to microprocessors notes
Introduction to microprocessors notes
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
 
Introduction to microprocessor notes
Introduction to microprocessor notesIntroduction to microprocessor notes
Introduction to microprocessor notes
 
Decimation in time and frequency
Decimation in time and frequencyDecimation in time and frequency
Decimation in time and frequency
 
RT linux
RT linuxRT linux
RT linux
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
I o ports and timers of 8051
I o ports and timers of 8051I o ports and timers of 8051
I o ports and timers of 8051
 
Mos and cmos technology
Mos and cmos technologyMos and cmos technology
Mos and cmos technology
 
Logic families
Logic familiesLogic families
Logic families
 
Clampers and clippers
Clampers and clippersClampers and clippers
Clampers and clippers
 
Linked lists
Linked listsLinked lists
Linked lists
 
Arrays
ArraysArrays
Arrays
 
Electro Magnetic Wave Propagation
Electro Magnetic Wave PropagationElectro Magnetic Wave Propagation
Electro Magnetic Wave Propagation
 
Satellite communications
Satellite communicationsSatellite communications
Satellite communications
 
Electronics in daily life
Electronics in daily lifeElectronics in daily life
Electronics in daily life
 
BSc I year practicals
BSc I year practicalsBSc I year practicals
BSc I year practicals
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
 
Applications of op amps
Applications of op ampsApplications of op amps
Applications of op amps
 
Digital logic gates and Boolean algebra
Digital logic gates and Boolean algebraDigital logic gates and Boolean algebra
Digital logic gates and Boolean algebra
 
Graphs in c language
Graphs in c languageGraphs in c language
Graphs in c language
 

Recently uploaded

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 

Recently uploaded (20)

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 

Unit iv microcontrollers final

  • 1. Dr. C. SARITHA DEPT. OF ELECTRONICS UNIT IV Applications of Embedded Systems Temperature Measurement : Transducers convert physical data such as temperature, light intensity, flow and speed to electrical signals. Depending on the transducer, the output produced is in the form of voltage, current, resistance or capacitance. For example, temperature is converted to electrical signals using a transducer called a thermistor. A thermisor responds to temperature change by changing resistance, but its response is not linear. So, writing the software for such nonlinear devices is difficult. To overcome this difficultly many manufacturers released linear temperature sensors include LM34 and LM35 series from National Semiconductors. LM35 Sensor : The LM series sensors are precision integrated circuit temperature sensors whose output voltage is linearly proportional to the Celsius (centigrade) temperature. The LM35 requires no external calibration since it is inherently calibrated. It outputs 10mV for each degree of centigrade temperature. Its temperature range is -55C to +150C. Signal Conditioning and Interfacing the LM35 to 8051: Signal conditioning is widely used term in the world of data acquisition. The most common transducers produce an output in the form of voltage, current, charge, capacitance, and resistance. However, we need to convert these signals to voltage in order to send input to an A to D converter. This conversion is commonly called signal conditioning. Signal conditioning can be a current to voltage conversion or a signal amplification. For example, the thermistor changes resistance with temperature. The change of resistance must be translated into voltages in order to use to an ADC. Now, consider the case of connecting an LM35 to an ADC 0809. Since, ADC0809 has 8-bit resolution with a maximum of 256 (28 ) steps and the LM35 produces 10mV for every degree of temperature change, we need to set Vref(+) = 2.56V of the ADC 0809 to produce a Vout of 2560mV (2.56V). 1
  • 2. Dr. C. SARITHA DEPT. OF ELECTRONICS Interfacing diagram of LM35 with 8051: As shown in the diagram Port 1 of 8051 microcontroller is connected to the data lines of ADC0809. The address lines C, B, and A are grounded. So, Channel 0 is selected to apply the analog input. To deactivate the remaining channels, they are grounded. Here, Vref (+) is supplied with 2.56V, to get a 10mV step size. Vcc and OE are connected to +5V. Vref (-) and GND pins are connected to ground. CLK must be applied to the 10th pin of ADC by using a clock source. SOC line is used to start the conversion and ALE line is used to latch the address. To start the conversion and latch the address make these lines high through the microcontroller. Then conversion begins. After some time EOC line becomes high, to indicate the conversion is completed and the equivalent digital word is at Port 1. The timing diagram shows the entire procedure of analog to digital conversion. Fig(i): Timing diagram for ADC 0809 2
  • 3. Dr. C. SARITHA DEPT. OF ELECTRONICS Program: START: SETB P3.4 ; Set SOC = 1, ALE = 1 ACALL DELAY ; Call for the delay CLR P3.4 ; Clear SOC and ALE HERE: JNB P3.5, HERE ; Check, for EOC = 1 MOV A, P1 ; Move the data from Port 1 to A SJMP START ; Continue the same Result : Temperature in o C Vin (mV) Digital output in Hex 0 1 2 3 10 30 0 10 20 30 100 300 00 01 02 03 0A 1E Displaying of Information on LCD: In LCD, liquid crystal solution is sandwiched by two sheets for polarizing material. LCD is used to display the status information or to display prompts to the user. The display can be as small as 1 line with 8 characters. Other displays used in embedded systems can be of 6.4 inch or 8.4 inch etc. The diagonal distance is indicated as display size. . Advantages : • Less cost • Small size • Ability to display numbers, characters and graphics • Incorporation of a refreshing controller into the LCD, reduces the work of CPU • Ease of programming for characters and graphics 3
  • 4. Dr. C. SARITHA DEPT. OF ELECTRONICS LCD pin descriptions : Pin Numbe r Symbol Description 1 VSS Ground 2 VCC +5V power supply 3 VEE Power supply to control contrast 4 RS RS=0 to select command register RS=1 to select data register 5 R/W R/W=0 for write, R/W=1 for read 6 EN Enable 7 D0 8-bit data bus 8 D1 8-bit data bus 9 D2 8-bit data bus 10 D3 8-bit data bus 11 D4 8-bit data bus 12 D5 8-bit data bus 13 D6 8-bit data bus 14 D7 8-bit data bus RS (Register Select): There are two very important registers inside the LCD. If RS=0, the command register is selected, allowing the user to send a command. If RS=1, the data register is selected, allowing the user to send a data to be displayed on the LCD. R/W (Read/Write) : R/W input allows the user to write information to the LCD or read information from it. R/W =1 when reading, R/W=0 when writing. EN (Enable) : The enable pin is used by the LCD to latch information presented to its data pins. To latch the data from the data pins, a high to low pulse must be applied to this pin. D0-D7 (Data pins): The 8 bit data pins, D0-D7, are used to send information to the LCD or read the contents of the LCD’s internal registers. To display letters and numbers, we send ASCII codes for the letters 4
  • 5. Dr. C. SARITHA DEPT. OF ELECTRONICS A – Z, a – z, and numbers 0 – 9 to these pins while making RS=1. There are also commands that can be sent to the LCD to clear the display or force the cursor to the home position or blink the cursor when RS=0. LCD Commands : Code in Hex Command to LCD 01 Clear display 02 Return home 04 Decrement cursor 06 Increment cursor 05 Shift display right 07 Shift display left 0E Display on, Cursor blinking 80 Force cursor to beginning of 1st line C0 Force cursor to beginning of 2nd line 38 Initialize the LCD display Interfacing the LCD display to 8051: In the above circuit diagram a 2x16 line LCD display is connected to the 8051 microcontroller. First, Port 1 lines of 8051 are connected to the D0-D7 lines of the LCD. Then, three lines of Port 2 i.e., P2.0, P2.1 and P2.2 are connected to RS, R/W and EN pins of the LCD respectively. The Vcc line is supplied with +5V and Vss is connected to ground. The VEE line is used to adjust the contrast of the LCD by connecting a +5V supply through a 10KΩ Potentiometer. Program to display a message on LCD : MOV A, #38H ; Initialize the LCD display ACALL CMDWRT ; Call command subroutine 5
  • 6. Dr. C. SARITHA DEPT. OF ELECTRONICS ACALL DELAY ; Call delay MOV A, #0EH ; display on, cursor on ACALL CMDWRT ; Call command subroutine ACALL DELAY ; Call delay MOV A, #01H ; Clear LCD ACALL CMDWRT ; Call command subroutine ACALL DELAY ; Call delay MOV A, #06H ; Shift cursor right ACALL CMDWRT ; Call command subroutine ACALL DELAY ; Call delay MOV A, #80H ; Cursor at line1 ACALL CMDWRT ; Call command subroutine ACALL DELAY ; Call delay MOV A, #’L’ ; Display letter L ACALL DATWRT ; Call data subroutine ACALL DELAY ; Call delay MOV A, #’C’ ; Display letter C ACALL DATWRT ; Call data subroutine ACALL DELAY ; Call delay MOV A, #’D’ ; Display letter D ACALL DATWRT ; Call data subroutine AGAIN: SJMP AGAIN ; Stay here CMDWRT: ; Send command to LCD MOV P1, A ; Copy the contents of register A to Port 1 CLR P2.0 ; RS=0 for command register CLR P2.1 ; R/W=0 for write operation SETB P2.2 ; E=1 for high pulse CLR P2.2 ; E=0 for H-to-L pulse RET ; Return to main program DATWRT: ; Send data to LCD MOV P1, A ; Copy the contents of register A to Port 1 SETB P2.0 ; RS=1 for data register CLR P2.1 ; R/W=0 for write operation SETB P2.2 ; E=1 for high pulse 6
  • 7. Dr. C. SARITHA DEPT. OF ELECTRONICS CLR P2.2 ; E=0 for H-to-L pulse RET ; Return to main program DELAY: MOV R3, #50H ; Set R3=50H LOOP: MOV R4, #0FFH ; Set R4=0FFH LOOP1: DJNZ R4, LOOP ; Decrement R4, till it becomes zero DJNZ R3, LOOP1 ; Decrement R3, till it becomes zero RET ; Return to main program Control of Stepper motor : A stepper motor is a widely used device that translates electrical pulses into mechanical movement. In applications such as disk drives, dot matrix printers and robotics, the stepper motor is used for position control. Every stepper motor has a permanent magnet rotor (also called the shaft) surrounded by a stator. The most common stepper motors have four stator windings that are paired with a center-tapped common as shown in fig (a). Fig (a): Stator windings configuration This type of stepper motor is commonly referred to as a four phase stepper motor. The center tap allows a change of current direction in each of two coils when a winding is grounded, thereby resulting in a polarity change of the stator. Notice that while a conventional motor shaft runs freely, the stepper motor shaft moves in a fixed repeatable increment which allows one to move it to a precise position. This repeatable fixed movement is possible as a result of basic magnetic theory where poles of the same polarity repel and opposite poles attract. The direction of the rotation is dictated by the stator poles. The stator poles are determined by the current sent through the wire coils. As the direction of the current is changed, the polarity is also changed causing the reverse motion of the rotor. The stepper used here has a total of 6 leads : 4 leads representing the four stator winding and 2 commons for the center tapped leads. As the sequence of power is applied to each stator winding, the rotor will rotate. There are several widely used sequences where each has a different degree of precision. Table 1 shows the normal 4 step sequence. Table 1 : Normal 4-step sequence 7
  • 8. Dr. C. SARITHA DEPT. OF ELECTRONICS Clockwise Step Winding A Winding B Winding C Winding D Counter clockwise1 1 0 0 1 2 1 1 0 0 3 0 1 1 0 4 0 0 1 1 It must be noted that although we can start with any of the sequences, once we start we must continue in the proper order. Step angle : The step angle is the minimum degree of rotation associated with a single step. Various motors have different step angles Steps per revolution : This is the total number of steps needed to rotate one complete rotation or 3600 (Ex: 1.8 degrees x 200 steps = 360 degrees). Motor speed : The motor speed is measured in steps per second, is a function of the switching rate. We know that Steps per second = (RPM x Steps per revolution)/60. Notice that, by changing the length of the time delay, we can get various rotation speeds. Interfacing diagram for Stepper motor : In the above diagram, the four leads of the stator winding are connected to the four bits of the 8051 port i.e., P1.0, P1.1, P1.2 and P1.3 respectively. These four bits will control the motor. However, since the 8051 lacks sufficient current to drive the stepper motor windings, we must use a driver such as the ULN2003 to energize the stator. The common wires are connected the positive side of the motors power supply. In many motors +5V is sufficient. By applying proper sequence to the stator windings, we can rotate the motor in both clockwise and anti-clockwise directions. 8
  • 9. Dr. C. SARITHA DEPT. OF ELECTRONICS Program to rotate a stepper motor in clock wise direction: MOV A, #66H ; Load step sequence BACK: MOV P1, A ; Issue sequence to motor through Port 1 RR A ; Rotate right, clockwise by one step ACALL DELAY ; wait SJMP BACK ; Repeat the same DELAY: MOV R3, #50H ; Set R3=50H LOOP: MOV R4, #0FFH ; Set R4=0FFH LOOP1: DJNZ R4, LOOP ; Decrement R4, till it becomes zero DJNZ R3, LOOP1 ; Decrement R3, till it becomes zero RET ; Return to main program Program to rotate a stepper motor in anti-clock wise direction: MOV A, #66H ; Load step sequence BACK: MOV P1, A ; Issue sequence to motor through Port 1 RL A ; Rotate left, anti-clockwise by one step ACALL DELAY ; wait SJMP BACK ; Repeat the same DELAY: MOV R3, #50H ; Set R3=50H LOOP: MOV R4, #0FFH ; Set R4=0FFH LOOP1: DJNZ R4, LOOP ; Decrement R4, till it becomes zero DJNZ R3, LOOP1 ; Decrement R3, till it becomes zero RET ; Return to main program Note : To increase the speed of the motor, keep R3 value less or to decrease the speed of the motor keep R3 value high. Keyboard Interfacing to the 8051: Keyboards are the most widely used input device. These keyboards are organized in a matrix of rows and columns through ports, therefore, with two 8-bit ports, an 8x8 matrix of keys can be connected to a microcontroller. When a key is pressed, a row and a column make a contact, otherwise, there is no connection between rows and columns. Fig (a) shows a 4x4 matrix connected to two ports. The rows are connected to an output port and the columns are connected to an input port. If no key has been pressed, reading the 9
  • 10. Dr. C. SARITHA DEPT. OF ELECTRONICS input port will yield 1s for all columns since they are all connected to high (Vcc). If all the rows are grounded and a key is pressed, one of the columns will have 0 since the key pressed provides the path to ground. It is the function of the microcontroller to scan the keyboard continuously to detect and identify the key pressed. Fig (a) : Matrix keyboard connection to ports Grounding rows and reading columns : To detect a pressed key, the microcontroller grounds all rows by providing 0 to the output latch, then it reads the columns. If the data read from the columns is D3-D0 = 1111, no key has been pressed and the process continues until a key press is detected. However, if one of the column bits has a zero, this means that a key press has occurred. For example, if D3-D0 = 1101, this means that a key in the 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 columns. If the data read is all 1s, no key in that row is activated and the process is moved to the next row. It grounds the next row, reads the columns, and checks for any zero. This process continues until the row is identified. After identification of 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 the microcontroller knows at any time which row and column are being accessed. Program: This program sends the ASCII code for pressed key to Port 0 MOV P2, #0FFH ; Make P2 an input port K1: MOV P1, #00H ; Ground all rows at once MOV A, P2 ; Read all columns 10
  • 11. Dr. C. SARITHA DEPT. OF ELECTRONICS ANL A, #00001111B ; Mask unused bits CJNE A, #00001111B, K1 ; Check till all keys released K2: ACALL DELAY ; Call 20 msec delay MOV A, P2 ; See if any key is pressed ANL A, #00001111B ; Mask unused bits CJNE A, #00001111B, OVER ; Key pressed, await closure SJMP K2 ; Check if key is pressed OVER: ACALL DELAY ; Wait 20 msec debounce time MOV A, P2 ; Check key closure ANL A, #00001111B ; Mask unused bits CJNE A, #00001111B, OVER1 ; Key pressed, find row SJMP K2 ; If none, keep polling OVER1: MOV P1, #11111110B ; Ground row 0 MOV A, P2 ; Read all columns ANL A, #00001111B ; Mask unused bits CJNE A, #00001111B, ROW_0 ; Key pressed in row 0, find the column MOV P1, #11111101B ; Ground row 1 MOV A, P2 ; Read all columns ANL A, #00001111B ; Mask unused bits CJNE A, #00001111B, ROW_1 ; Key pressed in row 1, find the column MOV P1, #11111011B ; Ground row 2 MOV A, P2 ; Read all columns ANL A, #00001111B ; Mask unused bits CJNE A, #00001111B, ROW_2 ; Key pressed in row 2, find the column MOV P1, #11110111B ; Ground row 3 MOV A, P2 ; Read all columns ANL A, #00001111B ; Mask unused bits CJNE A, #00001111B, ROW_3 ; Key pressed in row 3, find the column LJMP K2 ; If none, false input, repeat ROW_0: MOV DPTR, #KCODE0 ; Set DPTR=start of row 0 SJMP FIND ; Find column key belongs to ROW_1: MOV DPTR, #KCODE1 ; Set DPTR=start of row 1 SJMP FIND ; Find column key belongs to ROW_2: MOV DPTR, #KCODE2 ; Set DPTR=start of row 2 11
  • 12. Dr. C. SARITHA DEPT. OF ELECTRONICS SJMP FIND ; Find column key belongs to ROW_3: MOV DPTR, #KCODE3 ; Set DPTR=start of row 3 SJMP FIND ; Find column key belongs to FIND: RRC A ; See if any carry bit low JNC MATCH ; If zero, get the ASCII code INC DPTR ; Point to next column address SJMP FIND ; Keep searching MATCH: CLR A ; Set A=0 (Match is found) MOVC A, @A+DPTR ; Get ASCII code from table MOV P0, A ; Display pressed key LJMP K1 ; Repeat the same for next key press 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 Waveform generation using DAC0800 : Digital to analog converters are used to convert digital quantity to analog quantity. D/A converter produces an output proportional to the digital quantity (binary word) applied to its input. A most widely used DAC chip is DAC 0800. This chip is also used to generate different waveforms. Features of DAC0800: • It is an 8-bit DAC • It has fast settling time : 100ns • The conversion technique used is R-2R ladder network method • It operates at +4.5V to +18V supply • Low cost • Full scale error: ±1 LSB • Low power consumption Interfacing diagram of DAC with 8051: 12
  • 13. Dr. C. SARITHA DEPT. OF ELECTRONICS As shown in the diagram Port 1of 8051 microcontroller is connected to the data lines of DAC. The supply V+ is connected to the +5V or +12V. V- is connected to the -12V. The DAC 0800 is a current output device. So, an op-amp is used, to convert the output of DAC i.e., current to voltage. One of the applications of an op amp is as a current to voltage converter. The output of the op amp is connected to a CRO, in which the corresponding wave form will appear, depending the assembly language program. Program to generate Square wave: HERE: MOV A, #0FFH ; Load A=0FFH MOV P1, A ; Sent FFH to Port 1 LACLL DELAY ; Call delay subroutine MOV A, #00H ; Load A=00H MOV P1, A ; Sent 00H to Port 1 LCALL DELAY ; Call delay subroutine SJMP HERE ; Go to label HERE DELAY: MOV R3, #0FFH ; Load R3 with FFH LOOP: DJNZ R3, LOOP ; Decrement R3 by1 and if R3≠0 go to label LOOP RET ; Return to main program Program to generate Rectangular wave: 13
  • 14. Dr. C. SARITHA DEPT. OF ELECTRONICS HERE: MOV A, #0FFH ; Load A=FFH MOV P1, A ; Sent FFH to Port 1 LACLL DELAY1 ; Call larger delay subroutine MOV A, #00H ; Load A=00H MOV P1, A ; Sent 00H to Port 1 LCALL DELAY2 ; Call smaller delay subroutine SJMP HERE ; Go to label HERE DELAY1: MOV R5, #0FF ; Load R5 with FFh LOOP: MOV R6, #0FF ; Load R6 with FFh HERE: DJNZ R6, HERE ; Decrement R6 by1 and if R6≠0 go to label HERE DJNZ R5, LOOP ; Decrement R5 by1 and if R5≠0 go to label LOOP RET ; Return to main program DELAY2: MOV R3, #0FF ; Load R3 with FFh LOOP: DJNZ R3, LOOP ; Decrement R3 by1 and if R3≠0 go to label LOOP RET ; Return to main program Program to generate sawtooth wave: MOV A, #00H ; Load A=00h BACK: MOV P1, A ; Sent the value of A to Port1 INC A ; Increment the value of A by 1 SJMP BACK ; Repeat the same Program to generate Triangular wave: BACK: MOV A, #00H ; Load A=00h 14
  • 15. Dr. C. SARITHA DEPT. OF ELECTRONICS INCR: MOV P1, A ; Sent the value of A to Port1 INC A ; Increment the value of A by 1 CJNE A, #0FF, INCR ; Compare if A=0FFH, if not, goto label INCR DECR: MOV P1,A ; Sent the value of A to Port1 DEC A ; Decrement the value of A by 1 CJNE A, #00, DECR ; Compare if A=00H, if not, goto label DECR SJMP BACK ; Repeat the same Program to generate Step wave: BACK: MOV A, #00H ; Load A=00h MOV P1, A ; Sent the value of A to Port1 ACALL DELAY ; Call delay subroutine LOOP: ADD A, #33H ; Add the data 33H to the contents of A MOV P1, A ; Sent the value of A to Port 1 ACALL DELAY ; Call delay subroutine CJNE A, #0FFH, LOOP ; Compare if A=0FFH, if not, goto label LOOP SJMP BACK ; Repeat the same Program to generate Sine wave: AGAIN: MOV DPTR, #TABLE ; Load DPTR with the address of TABLE MOV R2, #COUNT ; Load R2 with count BACK: CLR A ; Clear Accumulator i.e., A=00 MOVC A,@A+DPTR ; Go to the look up table for getting the value MOV P1, A ; Move the lookup table value to Port 1 15
  • 16. Dr. C. SARITHA DEPT. OF ELECTRONICS INC DPTR ; Increment DPTR by 1 DJNZ R2, BACK ; Decrement R2 by1 and if R2≠0 go to label LOOP SJMP AGAIN ; Repeat the same TABLE: DB 128, 192, 238, 255, 238, 192 ; Sine wave for 300 DB 128, 64, 17, 0, 17, 64, 128 16 ALL THE BEST