29
UNIT-V 5.1 UNIT 5 MICROCONTROLLER APPLICATIONS

MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.1

UNIT 5

MICROCONTROLLER

APPLICATIONS

Page 2: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.2

CONTENTS

Technical Terms

5.1 Interfacing LCD Display

5.2 DAC Interface

5.2.1 Pin diagram & block diagram of DAC0800

5.2.2 Interfacing DAC0800 with 8031/8051 Microcontroller

5.3 Interfacing ADC

5.3.1 ADC0809

5.3.2 ADC0809 interfacing with 8051

5.4 Temperature Control

5.4.1 Microprocessor based temperature control system

5.5 Stepper Motor

5.5.1 Construction

5.5.2 Interfacing

5.6 Keyboard Interface

5.6.1 Key bounce using software

5.6.2 Simple keyboard Interface

5.6.3 Matrix Keyboard interface

5.7 Motor Speed Control System

5.7.1 DC motor (or) direct current motor

5.7.2 DC motor speed control

5.7.3 Pulse Width Modulation (PWM)

5.7.4 DC motor control using L293

5.7.5 DC motor control using Optoisolator

Question Bank

Page 3: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.3

TECHNICAL TERMS

1. Interface : Connection of external device to the microprocessor

2. LCD : Liquid Crystal Display

3. DAC : IC that converts the digital output of Microcontroller to Analog output

4. ADC : IC that converts the Analog input to the Microcontroller to Digital Input

5. Resolution : Minimum value that can be represented by the analog or digital data

Page 4: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.4

5.1 Interfacing LCD Display

Nowadays, many LCD modules are available which have build –in drives for LCD and

interfacing circuitry to interface then to microprocessor /microcontroller systems . These

LCD modules allow display of characters as well as numbers .They are available in

16x2,20x1,20x2,20x4 & 40x2sizes.The main advantage of using LCD is modules is that they

required very less power .The first figure represents number of character in each line and

second figure represents no of lines the display has. The interfacing of 20x2 LCD display to

microprocessor/microcontroller system through 8255 is discussed. In this module the display

is organized as two lines, each of 20 characters The module has 14 pins.

Fig 5.1: Liquid crystal display

The interfacing of a 20 character 2 line LCD module with the 8051 is shown. The data

lines are connected to the port 1 of 8051 and control lines RS, R/W and E are driven by 3.2,

3.3 and 3.4 lines of port 3, respectively .The voltage at V EE pin is adjusted by a

potentiometer to adjust the contrast of LCD.

Page 5: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.5

Fig 5.2: LCD interface with 8051

Page 6: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.6

To display a message on LCD module, it is necessary to initialize it by writing series of

command codes in the command in the register in the proper sequence .The initialization

cursor automatically after writing a character. After initialization we can write data to either

DD RAM or CG RAM. Both RAMs are read/write RAMS an have unique addresses to

access each location. To write data in any RAM we have to set the address for that RAM by

issuing proper commands. Then we can write data into it by activating write cycle . To

activate write cycle we have to make R/W signal low, RS signal high, send data on port A

and apply high to low pulse of at least 450 ns of duration on E pin of the module .The DD

RAM stores the character in their ASCII code whereas CG RAM stores the character in its

internally generated character code .Let us see the 805 assembly language program to display

‘WELCOME’ message on the LC module .Before sensing command or data it is necessary to

check busy flag , i.e. whether LCD us reading or not .

Main Routine:

MOV 81H, #30h Initialise stack pointer

MOV A, #3Ch send command code to set font

LCALL COMMAND

MOV A, #OEh send command code to set display

LCALL COMMAND

MOV A, #O1h send command code to clear LCD

LCALL COMMAND

MOV A, #86h send command code set DD RAM

LCALL COMMAND

MOV A, ‘W’ Display lettter W

LCALL DISPLAY

MOV A, ‘E’ Display lettter E

LCALL DISPLAY

MOV A, ‘L’ Display lettter L

LCALL DISPLAY

MOV A, ‘C’

LCALL DISPLAY Display lettter C

MOV A, ‘O’

LCALL DISPLAY Display lettter O

MOV A, ‘M’

LCALL DISPLAY Display lettter M

Page 7: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.7

MOV A, ‘E’

LCALL DISPLAY Display lettter E

SJMP Here:Here Look here after displaying message

Command Routine:

LCALL READY Check whether LCD is ready?

MOV P1, A Issue command code

CLR P3.2 Make RS=0 to issue command

CLR P3.3 Make R/ = 0 to enable writing command

SETB P3.4 Make E=1

CLR P3.4 Make E=0

RET Return

READY Routine:

CLR P3.4 Disable display

CLR P3.2 make RS = 0 to access command register

MOV P1, #OFFh configure p1 as an input port

SETB P3.3 Make R/ = 0 to eneble reading

SETB P3.4 Make E = 1

JB P1.7, READ Check DB7 bit. If it is 1, LCD is busy hence check

if until it is 0

CLR P3.4 Make E = 0 to disable display

RET Return

Display Routine:

LCALL READY Check whether LCD is ready?

MOV P1, A Issue data

SETB P3.2 Make RS = 1 to issue data

CLR P3.3 Make R/ = 0 to enable writing

SETB P3.4 Make E = 1

CLR P3.4 Make E = 0

RET Return

Page 8: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.8

5.2 DAC Interface

To convert the digital signal to analog signal a Digital-to-Analog Converter (DAC) has to

be employed.

The DAC will accept a digital (binary) input and convert to analog voltage or current.

Every DAC will have “n” input lines and an analog output.

The DAC require a reference analog voltage (Vref) or current (Iref) source.

The smallest possible analog value that can be represented by the n-bit binary code is

called resolution.

The resolution of DAC with n-bit binary input is 1/2nof reference analog value.

Every analog output will be a multiple of the resolution.

For example, consider an 8-bit DAC with reference analog voltage of 5 volts. The analog

values for all possible digital input are as shown.

5.2.1 Pin diagram & block diagram of DAC0800

The DAC0800 is an 8-bit, high speed, current output DAC with a typical settling time

(conversion time) of 100 ns.

It produces complementary current output, which can be converted to voltage by using

simple resistor load.

The DAC0800 require a positive and a negative supply voltage in the range of ± 5V to

±18V.

It can be directly interfaced with TTL, CMOS, PMOS and other logic families.

For TTL input, the threshold pin should be tied to ground (VLC = 0V).

Page 9: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.9

The reference voltage and the digital input will decide the analog output current, which

can be converted to a voltage by simply connecting a resistor to output terminal or by

using an op-amp I to V converter.

The DAC0800 is available as a 16-pin IC in DIP.

The pin configuration of DAC0800 is,

Fig 5.3: Pin configuration of DAC0800

The internal block diagram of DACO800 is,

Page 10: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.10

Fig 5.4: Block diagram of DAC000

5.2.2 Interfacing DAC0800 with 8031/8051 Microcontroller

In simple systems, when the ports are free the DAC0800 can be directly interfaced to an

8-bit port of any 8x5x family of controller as shown.

Fig 5.5: Interfacing DAC0800 with 8031/8051 Microcontroller

In this system the controller can be programmed to work as signal generator for various

applications and the program can be permanently stored in the internal program memory

of the controller.

Since the 8x5x ports are internally provided with latch there is no need for external latch

to interface DAC0800.

The DAC0800 can also be interfaced to 8031/8051 microcontroller as memory mapped

I/O as,

Page 11: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.11

Fig 5.6: DAC memory mapped interface with 8051

In this case an 8-bit latch such as 74LS273 is interfaced to system bus and mapped in the

data memory address space with 16-bit address.

The DAC0800 is connected to output lines of the latch. The controller will load the digital

data to the latch and it will hold the data on its output lines.

The next data will be loaded to latch only when previous data has been converted to

analog value.

The loading of consecutive data to the latch of DAC is controlled by software time delay.

The address lines A13, A14 and A15 are decoded to generate 8 chip select signals and in

this the low signal CS3 is used as logic low enable for the DAC latch 74LS273.

The low signals RD and WR are logically ANDed and used as logic low enable for

decoder and the low signal PSEN is as logic high enable for decoder.

The address allotted to DAC latch is,

Page 12: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.12

Program:

MOV SP, #08H

REPEAT: MOV PI, #0FFH

MOV P, #00H

LCALL DELAY

LJMP REPEAT

DELAY: MOV R0, #0FFH

BACK: DJNZ R0, BACK

RET

5.3 Interfacing ADC

5.3.1 ADC 0809

The ADC0809 is an 8-bit successive approximation type ADC with inbuilt 8-channel

multiplexer.

The ADC0809 is suitable for interface with 8086 microprocessor.

The ADC0809 is available as a 28 pin IC in DIP (Dual Inline Package).

The ADC0809 has a total unadjusted error of ±1 LSD (Least Significant Digit).

The ADC0808 is also same as ADC0809 except the error. The total unadjusted error in

ADC0808 is ± 1/2 LSD.

The pin configuration of ADC0809/ADC0808 is,

Page 13: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.13

Fig 5.7: Pin configuration or ADC0809

Page 14: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.14

The internal block diagram of ADC0809/ADC0808 is,

Fig 5.8: Internal block diagram of ADC0809

The various functional blocks of ADC are 8-channel multiplexer, comparator, 256R

resistor ladder, switch tree, successive approximation register, output buffer, address latch

and decoder.

The 8-channel multiplexer can accept eight analog inputs in the range of 0 to 5V and

allow one by one for conversion depending on the 3-bit address input. The channel

selection logic is,

Page 15: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.15

The successive approximation register (SAR) performs eight iterations to determine

the digital code for input value. The SAR is reset on the positive edge of START

pulse and start the conversion process on the falling edge of START pulse.

A conversion process will be interrupted on receipt of new START pulse.

The End-Of-Conversion (EOC) will go low between 0 and 8 clock pulses after the

positive edge of START pulse.

The ADC can be used in continuous conversion mode by tying the EOC output to

START input. In this mode an external START pulse should be applied whenever

power is switched ON.

The 256’R resistor network and the switch tree is shown in fig.

Fig 5.9: 256’R resistor network

The 256R ladder network has been provided instead of conventional R/2R ladder because

of its inherent monotonic, which guarantees no missing digital codes.

Also the 256R resistor network does not cause load variations on the reference voltage.

The comparator in ADC0809/ADC0808 is a chopper- stabilized comparator. It converts

the DC input signal into an AC signal, and amplifies the AC sign using high gain AC

amplifier. Then it converts AC signal to DC signal. This technique limits the drift

component of the amplifier, because the drift is a DC component and it is not

amplified/passed by the AC amp1ifier. This makes the ADC extremely insensitive to

temperature, long term drift and input offset errors.

Page 16: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.16

5.3.2 ADC0809 interfacing with 8051

In ADC conversion process the input analog value is quantized and each quantized analog

value will have a unique binary equivalent.

The quantization step in ADC0809/ADC0808 is given by,

Fig 5.10: Interfacing ADC0809 with 8051

AD Conversion Program

MOV P1, #OFFH Configure port1 as input

BACK CLR P2.6 (make = 0 and

SETB P2.6 make = 1 to generate start of conversion

Pulse)

Again JB P2.7, Again Wait for end of conversion

CLR P2.5 Enable read

MOV A, P1 Read data through port1

SETB P2.5 Disable read after reading data

Page 17: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.17

SJMP BACK go for next conversion cycle

5.4 Temperature Control

Transducers convert physical data such as temperature, light intensity, flow and speed to

electrical signals.

The output of the temperature sensor is non linear. The complexity associated with

writing soft ware for such non linear devices has led to the manufacturing of linear

temperature sensor.

Example: LM34 and LM35

The transducers produce an output in the form of voltage, current, capacitance and resistance.

Signal conditioning can be current to voltage conversion or signal amplification.RTD is also

called Platinum RTD because it is typically made of platinum. A change in temperature

causes a change in resistance of platinum. This change can be measured with an ohmmeter.

Within a limited range, the resistance of metals increases in proportion to the temperature.

In theory, any metal could be used to measure temperature. The metal selected

should have a high melting point and an ability to withstand the effects of corrosion. Platinum

has therefore become the metal of choice for RTD's. Its desirable characteristics include

chemical stability, availability in a pure form, and electrical properties that are highly

reproducible.

5.4.1 Microprocessor based temperature control system

Fig 5.11: Temperature sensor interface with 8051

Page 18: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.18

Fig 5.12: Flowchart of control algorithm

The change of resistance must be translated into voltage in order to use an

ADC. ADC804 has 8bit resolution with a maximum of 256(28) steps and the LM35 produces

10mV for every degree of temperature change, we can condition Vin of the ADC804 to

produce the Vout of 2560 mV for full scale output.

5.5 STEPPER MOTOR

A stepper motor is a widely used device that translates electrical pulses into

mechanical movement

The stepper motor is used for position control in applications such as disk drivers, dot

matrix printers, and robotics, etc.

Every stepper motor has a permanent magnet rotor (also called the shaft) surrounded

by a stator .

5.5.1 Construction

Page 19: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.19

Fig 5.13: Construction diagram of stepper motor

The most common stepper motors have four stator windings that are paired with a

center-tapped common.

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.

Fig 5.14: Stator windings configuration

The stepper motor discussed here has a total of 6 leads, 4 leads representing the four

stator windings, 2 commons for the center tapped leads.

As the sequence of power is applied to each stator winding, the rotor will rotate. The

normal 4 step sequence

Page 20: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.20

5.5.2 Interfacing

Fig 5.15: Stepper motor interfacing

The step angle is the minimum degree of rotation associated with a angles for various

motors

The step per revolution is the total number of steps needed to rotate one complete

rotation or 360 degrees.

The relation between RPM (revolutions per minute), steps per revolution, and

steps per second is as follow

Steps/Sec = RPM x Steps per revolution / 60.

After completing every four steps, the rotor moves only one tooth pitch.

The smaller the step angle, the more teeth the motor passes.

Ex: In a stepper motor with 200 steps per revolution, its rotor has 50 teeth since 4 x 50

= 200 steps are needed.

To allow for finer resolutions, all stepper motors allow what is called an 8-step switching

sequence. It’s also called half-stepping, since each step is half of the normal step angle. The

Half step 8 step sequence is as follows

Page 21: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.21

5.6 Keyboard Interface

Push button keys are used to interface keyboard to microcontroller

based system. These push button keys when pressed, bounces a few times, closing and

opening the contacts before providing the steady reading.

Fig 5.16: Bouncing of key switch

5.6.1 Key bounce using software

If key press is found the controller wait for 10ms before it accepts the key as an

input. This time period is sufficient to settle the key.

Page 22: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.22

Fig 5.17: Flow chart of key input with bounce

5.6.2 Simple keyboard Interface

Fig 5.18: Simple keyboard Interface

Pins of Port1 are connected to keys. When port pin is logic 1, key is open,

otherwise key is closed.

Software routine to get key code with key debounce is as follows

START: MOV A, P1 read key status

Check if keys are open

CJNE A, #FFH, START if no, go to start otherwise continue.

Page 23: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.23

PRO: LCALL DEBOUNCE_DELAY call debounce delay

AGAIN: MOV A, P1 read key status

CJNE A, #FFH PRO1 check if any key is pressed

LJMP AGAIN if no go to AGAIN; otherwise continue

PRO1: LCALL DEBOUNCE_DELAY call debounce delay

MOV A, P1 get key code

RET Return from subroutine

The above program read the status of each keys by compare the port pins data with

FFH to check whether all keys are open. After that if all keys are open data is compared with

zero flag and wait for key bounce. After 10ms program check for key press.

5.6.3 Matrix Keyboard interface

Sixteen keys are arranged in 4 rows and 4 columns. When keys are

open no rows and columns are interconnected. When key is pressed it shorts corresponding

rows and columns.

Page 24: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.24

Fig 5.19: Matrix keyboard

Fig 5.20: Matrix keyboard interface

Check 1:

Whether any key is pressed or not.

1. Make all column lines zero by sending low on all output lines. This activates all keys

is in the keyboard matrix.

2. Read the status of return lines. If the status of all lines is logic high, key is not

pressed; otherwise key is pressed.

Check 2:

1. Activate keys from any one column by making any one column line zero.

2. Read the status of return lines. The zero on any return line indicates key is pressed

from the corresponding row and selected column. If the status of all lines is logic

high, key is not pressed from that column.

3. Activate the keys from the next column and repeat 2 and 3 for all columns.

Page 25: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.25

Fig 5.21: 4X4 matrix keyboard connected to port1 of 8051

The steps in algorithm

1. Initialize P1.0, P1.1, P1.2, and P1.3 as inputs.

2. Check if all keys are released by writing ‘0’ to P1.4-P1.7 and check all return lines are

in state ‘1’.

If yes then go to step 3.

3. Call debounce.

4. Wait for key closure. Ground all scan lines by writing ‘0’ and check if atleast one of

return lines shows ‘0’ level.

Key pressed? No step 4

Yes step 5

5. Call debounce.

6. Is key really pressed? No step 4

Yes step 7

7. Find key code and display the key pressed on 7-segment display.

8. Go to step 1

Program:

Org lookup_table_address

DB, 30h, 31h, 33h, 34h, 35h, 36h, 37h,

38h, 39h, 41h, 42h, 43h, 44h, 45h, 46h

Org program_start_address

Page 26: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.26

BEG: MOV A, P1, OFh configure lower 4 lines of port 1 as i/p

MOV DPTR, # lookup_table_address initialize dptr with lookup_table_addr.

AGA: MOV A, P1

ANL A, OFh

CJNE A, #OFh, AGA check for key released

LCALL DELAY call delay routine for key bounce

AGAL: MOV A, P1

ANL A, #OFh

CJNE A, #OFh, GO check for key pressed

LJMP AGAL

GO: LCALL DELAY call delay routine for key bounce

MOV A, P1

ANL A, #OFh

CJNE A, #OFh, GO1 Check whether key is really pressed?

LJMP AGAL

GO1: MOV r1, #01h initialize counter 1

MOV r0, #0EFh store word for column selection

MOV r3, #O4h initialize column counter

AGA3: MOV P1, r0 select only one column

MOV A, P1 get the status of return lines

JNB ACC.0, DISPLAY check bit 0 and if it is 0 jump to display

INC DPTR increment look_table pointer

JNB ACC.1, DISPLAY check bit 1 and if it is 1 jump to display

INC DPTR increment look_table pointer

JNB ACC.2, DISPLAY check bit 2 and if it is 2 jump to display

INC DPTR increment look_table pointer

JNB ACC.3, DISPLAY check bit 3 and if it is 3 jump to display

INC DPTR increment look_table pointer

MOV A,r0 get the word for column selecion

R1 A select next column

MOV r0, A store word for column selection

DJNZ r3, AGA3 check for last column

LJMP BEG if key any is not pressed scan again

END

Page 27: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.27

5.7 Motor Speed Control System

5.7.1 DC motor (or) Direct Current motor

It is a device which is used to translate electrical pulses into mechanical movement .It has

two terminals ‘+’ & ’-‘. If DC voltage is applied between these2 terminals then the motor is

rotated in one direction, if the terminals are reversed, then the motor is rotated in opposite

direction.

5.7.2 DC motor speed control

If the load is increased, then the rpm is decreased. If the motor is overloaded, then it will be

damaged due to the generation of heat.

1. Unidirectional control - DC motor is rotated in clock wise direction or in counter

clockwise direction.

2. Bidirectional control - By using relay, we can change the direction of the rotation of

the DC motor.

5.7.3 Pulse Width Modulation (PWM)

If the load is fixed, then we can maintain a steady speed by using pulse width by modulation

method .The speed of the motor can be increased or decreased by changing the width of the

pulse applied to the motor. This technique is mostly used in DC motor control.PWM circuit is

embedded in some microcontrollers.

5.7.4 DC motor control using L293

The interfacing circuit DC motor with 8051. Already we had seen the H-bridge

configuration. Here, diode is used as a switch .Bidirectional control is achieved by using by

above circuit .In 8051,we can write the program for motor control .Port 1 is used for

interfacing.

Fig 5.22: DC motor control using L293

5.7.5 DC motor control using Optoisolator

Page 28: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.28

Opto isolator is used for motor control. The capacitor C is connected across

DC motor. It is used to reduce the EMI produced by the motor. The collector of the transistor

is connected with the motor. Opto isolator is used for the protection purpose.

Fig 5.23: DC motor control using Optocoupler

PART A

1. What is resolution in DAC?

2. What are the internal devices of a typical DAC?

3. What is settling or conversion time in DAC?

4. What are the different types of DAC?

5. What are the different types of ADC?

6. What is resolution in ADC?

7. What is conversion time in ADC?

8. What is the function of DAC?

9. List the advantages of using LCD in the place of LEDs.

Page 29: MPMC UNIT-V III-YEAR EEE - Weeblyinstrumentationeie.weebly.com/.../4/55640025/unit_5_mpmc.pdf · 2019. 10. 3. · UNIT-V 5.3 TECHNICAL TERMS 1. Interface: Connection of external device

UNIT-V 5.29

10. What is the function of temperature sensor?

11. What is the operation of stepper motor?

12. Explain the DC motor speed control using 8051.

13. What is the function of keyboard & display unit?

PART B

1. Explain the Keyboard and display interface with 8051. Show the interfacing for a 4 X 4

keyboard matrix.

2. Explain the stepper motor control using 8051.

3. Explain the DC motor speed control using 8051.

4. Explain DAC and its interfacing with 8051.

5. Explain ADC and its interfacing with 8051.

6. Explain LCD and its interfacing with 8051.

7. Explain in detail the interfacing of temperature sensor with 8051.