Vous êtes sur la page 1sur 93

DEPARTMENT OF MECHANICAL ENGINEERING

ME6712-MECHATRONICS LAB MANUAL

SEVENTH SEMESTER
(2013 Regulation)

Prepared by,
Mr. M. Shanmugam, M.E., (PhD)
Assistant Professor,
Department of Mechanical Engineering,
Saveetha Engineering College, Chennai

NAME : ____________________________

YEAR/SEM : ____________________________

SECTION : ____________________________

REGISTER NO: ____________________________

1
Shanmugam M
SYLLABUS

ME6712 MECHATRONICS LABORATORY L T P C

0032

OBJECTIVES:

• To know the method of programming the microprocessor and also the design,

modeling & analysis of basic electrical, hydraulic & pneumatic Systems which

enable the students to understand the concept of Mechatronics.

LIST OF EXPERIMENTS:

1. Assembly language programming of 8085 – Addition – Subtraction –

Multiplication – Division – Sorting – Code Conversion.

2. Stepper motor interface.

3. Traffic light interface.

4. Speed control of DC motor.

5. Study of various types of transducers.

6. Study of hydraulic, pneumatic and electro-pneumatic circuits.

7. Modeling and analysis of basic hydraulic, pneumatic and electrical circuits

using Software.

8. Study of PLC and its applications.

9. Study of image processing technique

2
Shanmugam M
LIST OF EXPERIMENTS

CYCLE I:

1. Design of simple pneumatic circuit


2. Extension and retraction of single acting and double pneumatic cylinder
using DCV
3. Controlling the speed of the cylinder using metering in and metering out
valve circuit
4. Operation of double acting cylinder with logic gates
5. Design of continuous cycle circuit
6. Design of sequential circuit (pneumatics)
7. Design of electro pneumatic circuit
8. Single cycle automation of multiple cylinders in sequence (a+b+b-a-) using
electro pneumatic kit
9. Design of plc controlled electro pneumatic circuit
10. Design of simple hydraulic circuit
11. Design of Hydraulic circuit using hydraulic motor
12. Study and analysis of hydraulic system model using MATLAB software

CYCLE II:

1. Assembly language programming of 8085 microprocessor for simple


arithmetic operations:
(a) Addition (b) subtraction (c) multiplication and (d) division.
2. Assembly language programming of 8085 microprocessor for sorting
(a) Ascending order (b) Descending order.
3. Assembly language programming of 8085 microprocessor for Code
conversion.
(a) ASCII to hexadecimal number (b) hexadecimal to ASCII (c)
hexadecimal to decimal
a. number (d) binary to hexadecimal number and (e) hexadecimal to
binary number.
4. Stepper Motor Interfacing with 8051
(a) Run the stepper motor at different speed
(b) Run the stepper motor in forward and reverse direction
5. Traffic light interfacing.
6. Speed Control of DC motor.
7. Study of various types of transducers.
8. Study of Image processing techniques.

ADDITIONAL EXPERIMENTS

1. Design of three cylinder sequential circuit.


2. Design and Simulation of real time examples of above mentioned experiments.

3
Shanmugam M
INDEX

EXP. DATE NAME OF THE EXPERIMENT PAGE MARK SIGN


NO. NO.
1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

12.

13.

14.

15.

16.

17.

18.

19.

20.

4
Shanmugam M
INTRODUCTION TO MECHATRONICS SYSTEM

OBJECTIVE:
To study about the important features, applications and components of
Mechatronics system.

INTRODUCTION TO MECHATRONICS SYSTEM:

Mechatronics is one of the new and existing fields on the engineering


landscape, subsuming parts of traditional engineering fields and requiring a
broader approach to the design of system that we can formally call as
Mechatronics system.

Many industries improving their works through automation which is


based on the inter connection between the electronic control systems and
mechanical engineering.

Such control systems generally use microprocessors as controllers and


have electrical sensors extracting information from mechanical inputs through
electrical actuators to mechanical systems.

This can be considered to be application of computer based digital control


techniques through electronic and electric interfaces to mechanical engineering
problems. Successful design of Mechatronics can lead to products that are
extremely attractive to customer in quality cost-effectiveness.

MECHATRONICS DEFINITION:

Mechatronics may be defined as a multi-disciplinary field of study that


implies the synergistic integration of electronic engineering, electric engineering,
control engineering and computer technology with mechanical engineering for
the design, manufacture, analysis and maintenance of a wide range of
engineering products and processes.
“Mechatronics brings together areas of technology involving sensors and
measurement systems, drive and actuation systems, analysis of the behaviour of
systems microprocessor systems”.

5
Shanmugam M
The integration across the traditional boundaries of mechanical
engineering, electrical engineering, electronics and control engineering has to
occur at the earliest stages of the design process if cheaper, more reliable; more
flexible systems are to be developed.

APPLICATIONS OF MECHATRONICS ENGINEERING:


Mechatronics engineering finds application in the following fields.
 Electronic home appliances
 Electronic entertainment products
 Engine systems (cars)
 Large scale application

6
Shanmugam M
Schematic Layout of Hydraulic System

BASIC COMPONENTS OF A HYDRAULIC SYSTEM:

Reservoir (or air tank):


A reservoir is an oil supply tank. It is provided to hold the hydraulic liquid
(usually oil).
Pump:
The pump is used to force the liquid into the system.
Prime mover:
A Prime mover, usually an electric motor, is used to drive the pump.
Valves:
Valves are refitted in the system to control liquid direction, pressure, and
flow rate.
Actuator:

7
Shanmugam M
An actuator is provided to convert the liquid energy into mechanical force
or torque to do useful work. The actuator is the actual working element of the
system. The actuators can be either cylinders (to provide linear motion) or hydro
motors (to provide rotary motion).
Fluid-transfer piping:
The hydraulic Piping is provided to carry the compressed liquid from one
place to another.

Schematic Layout of Pneumatic System

BASIC COMPONENTS OF A PNEUMATIC SYSTEM:

Reservoir (or air tank):


An air tank is provided to store the compressed air required for the
operations.
Compressor:
The compressor is used to compress the atmospheric air so as to increase
the pressure of the air.
Prime mover:

8
Shanmugam M
A Prime mover, usually an electric motor, is used to drive the compressor.
Valves:
Valves are refitted in the system to control air direction, pressure, and
flow rate.
Actuator:
An actuator is provided to convert the air energy into mechanical force or
torque to do useful work.
Fluid-transfer piping:
Piping is provided to carry the compressed air from one place to another.

9
Shanmugam M
BASIC SYMBOLS USED IN HYDRAULIS AND PNEUMATIC SYSTEM:

10
Shanmugam M
11
Shanmugam M
12
Shanmugam M
13
Shanmugam M
14
Shanmugam M
15
Shanmugam M
DESIGN OF SIMPLE PNEUMATIC CIRCUIT
EXP NO: 1 DATE:

PROBLEM

A double acting cylinder is used for clamping and de-clamping work part in a
drilling machine. To actuate the cylinder for clamping and de-clamping, a
manually operated valve to be operated. Design a circuit.

AIM

To design a simple pneumatic circuit which can clamp and de-clamp the work
part in drilling machine when actuated manually.

APPARATUS REQUIRED

 Double acting
 Air supply
cylinder & FRL
 unit
Manually operated
 5/2 valveand Hoses
Fittings

CIRCUIT DESCRIPTION

Compressed air supply is given through the FRL unit to the manually operated
directional control valve. The output ports of the DC valve are connected to the
cylinder ports. In normal condition the cylinder is in the retracted condition
(de-clamping).

WORKING OF THE CIRCUIT

When the manually operated valve is pressed, the left side configuration of the
valve is come into operation and the pressurized air enters into the cover end
of the cylinder causing the cylinder to move forward. This clamps the work
part and after completing the drilling operation, the operator actuates the
valve to the other side. This now gives air to the piston end of the cylinder
retracts for de-clamping the work part.

RESULT

A circuit for the given problem is designed, constructed using the available
components and tested successfully.

16
Shanmugam M
1. Simple Pneumatic Circuit

17
Shanmugam M
EXTENSION AND RETRACTION OF SINGLE ACTING AND DOUBLE
PNEUMATIC CYLINDER USING DCV

EXPT NO: 2 DATE:

AIM:

To design and assemble a circuit that extends and retracts a single acting
spring return and double acting pneumatic cylinder using the Directional
Control Valve (DCV) in Pneumatic Trainer Kit.

APPARATUS REQUIRED:

 Connecting Tubes,
 Single Acting Spring return Cylinder,
 Double Acting Cylinder,
 3/2 Hand Levered Spring Return DCV,
 4/2 Hand Levered Spring Return DCV and
 FRL Unit

PROCEDURE:

1. Draw the Pneumatic circuit and check the connections carefully.


2. Connect the FRL unit to the main compressed air supply.
3. The various components are connected as per circuit.
4. Block the valve openings if necessary.
5. Check the leakage of air supply and correct it.
6. Open the valve and operate the cylinder.

RESULT:

Thus the single acting and double acting cylinder was operated using DCV in
Pneumatic Trainer Kit.

18
Shanmugam M
2a. Extension and Retraction of single acting pneumatic cylinder using DCV

2b. Extension and Retraction of Double Acting Cylinder using DCV

19
Shanmugam M
CONTROLLING THE SPEED OF THE CYLINDER USING METERING
IN AND METERING OUT VALVE CIRCUIT

EXPT NO: 3 DATE:

PROBLEM

Design a simple double acting cylinder circuit used for applications like feed a
drill bit and boring machine. The speed control of forward and return stroke
should be possible to get a positive feed control. The cylinder is actuated by a
manually operated valve.

AIM:

To control the speed of double acting cylinder using Metering In valve circuit in
Pneumatic Trainer Kit.

APPARATUS REQUIRED:

 Connecting tubes
 Double Acting Cylinder
 Flow Control Valve
 4/2 Hand Levered Spring Return DCV
 FRL Unit

PROCEDURE:

1. Draw the Pneumatic circuit and check the connections connection


carefully.
2. Connect the FRL unit to the main air supply.
3. The various components are connected as per circuit.
4. Block the valve openings if necessary.
5. Check the leakage of air supply and correct it.
6. Open the valve and operate the cylinder.

RESULT:

Thus the speed of double acting cylinder was controlled using Metering In
and Metering Out valve circuit in Pneumatic Trainer Kit.

20
Shanmugam M
3a. Controlling the Speed of the Cylinder using Metering In valve circuit

3b. Controlling the speed of the cylinder using Metering Out valve circuit

21
Shanmugam M
OPERATION OF DOUBLE ACTING CYLINDER WITH LOGIC GATES

EXPT NO: 4 DATE:

AIM:

To operate a double acting cylinder using AND/OR logic circuit in


Pneumatic Trainer Kit.

APPARATUS REQUIRED:

 Connecting tubes
 Double Acting Cylinder
 4/2 Pilot Operated DCV
 3/2 Hand Levered DCV
 Two Pressure Valve
 FRL Unit

PROCEDURE:

1. Draw the Pneumatic circuit and check the connections carefully.


2. Connect the FRL unit to the main air supply.
3. The various components are connected as per circuit.
4. Block the valve openings if necessary.
5. Check the leakage of air supply and correct it.
6. Open the valve and operate the cylinder.

RESULT:

Thus the double acting cylinder using AND/OR logic circuit was operated
in Pneumatic Trainer Kit.

22
Shanmugam M
4a. Operation of double acting cylinder with AND logic circuit

4b. Operation of double acting cylinder with OR logic circuit

23
Shanmugam M
DESIGN OF CONTINUOUS CYCLE CIRCUIT

EXPT NO: 5 DATE:

PROBLEM

A double acting cylinder is used to feed material for a punching press. For every cycle one
blank to be fed to the press. The cylinder has to start and stop its continuous operation when
a push button valve is operated. Design a circuit.

AIM
To design a continuously operating circuit as per the given requirement.

APPARATUS REQUIRED

 Double acting cylinder


 Pilot operated 4/2
 Air supply & FRL unit
valve
 Manually operated 3/2
 Lever
valve operated 3/2
 Fittings
valve and Hoses
CIRCUIT DESCRIPTION

The double acting cylinder gets power supply for its forward and return motion
from the pilot operated 4/2 directional control valve. The lever operated valves
are used as limit switches for the sensing of the end of the either stroke. These
valves are named as a0 and a1.The output from the limit switches are connected
as the pilots for operating the DC valve. The input power for the DC valve and
limit switches are given from the FRL unit through the manually operated 3/2
valve. The actuation of limit switches cause the cylinder motion as follows
a0 Cylinder forward motion
a1 Cylinder return motion

WORKING OF THE CIRCUIT

Initially let us assume the cylinder is in the return condition (a0 actuated) and
the manually operated valve in closed condition. If the manually operated valve
is actuated to open condition, air is allowed to pass to DC valve and limit
switches. This leads to the air output in a0 and this causes the cylinder forward
position. As the cylinder starts its forward movement, a0 is released and at the
end of the stroke a1 pressed. This leads to the reversal of the DC valve and the
cylinder starts its return motion. At the end of return stroke a0 got pressed and
this actuates the DC valve and the cylinder moves forward. This cycle continues
until the manually operated valve is moved to closed position.

RESULT
A circuit for the given problem is designed, constructed using the available
components and tested successfully.

24
Shanmugam M
5. Continuous Cycle Circuit

25
Shanmugam M
DESIGN OF SEQUENTIAL CIRCUIT (PNEUMATICS)

EXPT NO: 6 DATE:

PROBLEM
Two Pneumatic cylinders are used for loading and unloading of components.
The operating sequence of the cylinders is A+ B- A- B+. Design a circuit.
AIM
To design a pneumatic circuit for the given sequence.

COMPONENTS REQUIRED
 Double acting cylinder
 Pilot operated 4/2 valve
 Air supply & FRL unit
 Manually operated 3/2 valve
 Lever operated 3/2 valve
 Fittings and Hoses
 Automation Studio Software
PROCEDURE:

1. Draw the circuit in Automation Studio software and check the


connections carefully.
2. Connect the FRL unit to the main air supply.
3. The various components are connected as per circuit.
4. Block the valve openings if necessary.
5. Check the leakage of air supply and correct it.
6. Open the valve and operate the cylinder.

CIRCUIT DESCRIPTION
Two cylinders are named as A & B. The corresponding limit switches are a0 &
a1, and b0 & b1 for home and extended positions respectively. The directional
control valves for each cylinder are named as X & Y respectively and the
cylinders are connected to them. The DC valves and individual limit switches
are given with power from the FRL unit through a manually operated valve.
The output from the limit switches are given as pilot to the DC valves, to make
the respective cylinder to move. Manually operated 3/2 valve works as a start
switch. The output from each limit switch will create movement of cylinders as
follows
a1 B--
b0 A-
a0 B+
b1 A+

WORKING OF THE CIRCUIT


Compressed air through FRL unit enters to the direction control valves and
limit switches. At the home condition the cylinder A is at the retracted

26
Shanmugam M
condition and the cylinder B is in the extended condition. So limit switches a0
& b1 are in actuated condition and power comes to corresponding DC valves.
The manually operated valve is in closed condition initially. If the manually
operated valve is actuated to open
Condition, air is supplied to direction control valves and limit switches. Since
the limit switch b1 is in pressed condition the air goes to actuate the direction
control valve X and the cylinder moves forward. This causes the release of a0
and pressing of a1 at the end of the stroke. The output from a1 goes to Y as
pilot and shift it position. This gives power to the return stroke of cylinder B.
At the end of return stroke, b0 is pressed and the DC value X reversed. This
makes the cylinder A to return and at the end a0 is pressed. Due to this pilot Y
is reversed and B moves forward and at the end b1 is pressed. Thus the
cylinders A & B operate continuously until the manually operated valve is put
in close condition.

6. Sequential Circuit with pneumatic control for the given sequence A+ B- A- B+.

RESULT
The given circuit is designed, constructed with the available components and
checked for working.

27
Shanmugam M
DESIGN OF ELECTRO PNEUMATIC CIRCUIT

EXP NO: 7 DATE:


PROBLEM

A double acting cylinder is to be actuated by a solenoid operated valve. When


one push button is pressed the cylinder has to move forward and when another
is pressed it has to retract. Design a circuit.

AIM

To design the above given circuit.

APPARATUS REQUIRED

 Double acting cylinder


 4/2 double solenoid DC valve
 FRL unit
 Fittings and Hoses
 Required electrical components
CIRCUIT DESCRIPTION

Air from FRL unit is given to the DC valve. Two pressure ports of the valve are
connected to the two ports of the cylinder. Individual solenoid is energized by
pressing separate push buttons, as shown in the electrical circuit. In the
normal condition the cylinder is in the retracted position. Circuit is operated by
24 V D.C power supply.

WORKING OF THE CYLINDER

When the push button1is pressed, the solenoid A gets energized and the DC
valve is moved to its actuated condition. The air from the valve goes to the
cover end and the cylinder moves forward. Even after the push button is
released and solenoid de-energized, since there is no spring to return, the valve
and the cylinder remain at the same position. When the push button 2 is
pressed, the solenoid B is energized and that side of DC valve comes into effect.
This makes the cylinder to return. The next cycle starts when push button 1 is
pressed.

RESULT

The given circuit is designed, constructed with the available components and
tested successfully.

28
Shanmugam M
7. Electro Pneumatic Circuit

29
Shanmugam M
SINGLE CYCLE AUTOMATION OF MULTIPLE CYLINDERS IN
SEQUENCE (A+B+B-A-) USING ELECTROPNEUMATIC KIT

EXPT NO: 8 DATE:

AIM:

To operate single cycle automation of multiple cylinders in sequences (A+B+B-


A-) in Electro Pneumatic Trainer Kit.

APPARATUS REQUIRED:

 Automation Studio Software


 Double Acting Cylinder
 Input / Output Relay Box
 4/2 Solenoid Operated DCV
 Electrical Switch
 FRL Unit

PROCEDURE:

1. Draw the circuit in Automation Studio software and check the


connections.
2. Connect the FRL unit to the main air supply.
3. The various components are connected as per circuit.
4. Block the valve openings if necessary.
5. Check the leakage of air supply and correct it.
6. Open the valve and operate the cylinder.

RESULT:

Thus the single cycle automation of multiple cylinders was operated sequence
(A+B+B-A-) in Electro Pneumatic Trainer Kit.

30
Shanmugam M
8. Single cycle automation of multiple cylinders in sequences (A+B+B-A-) in
Electro Pneumatic Trainer Kit.

31
Shanmugam M
DESIGN OF PLC CONTROLLED ELECTRO PNEUMATIC CIRCUIT
EXPT NO: 9 DATE:

PROBLEM

Design a PLC controlled circuit to activate a piercing cylinder. The cylinder has
to be activated only if the work piece is sensed by the three sensors. If any two of
the three sensors sense the presence of the work part, the piercing cylinder can
be activated.

AIM
To design a circuit to activate a cylinder with PLC control.

APPARATUS REQUIRED
 Double acting cylinder
 5/2 solenoid controlled pilot operated spring return valve
 Sensors
 PLC and required electrical cables
 FRL unit
 Fittings and Hoses
 Electrical Power supply (24 volts)
 Interface box between PLC and sensors

CIRCUIT DESCRIPTION
The compressed air from the FRL unit is connected to the cylinder through the
DC valve. The DC valve is operated by the pilot pressure which is controlled by
the solenoid. The valve is spring return, so when the solenoid is energized, the
valve actuated the piercing cylinder moves forward.

PLC PROGRAMME

The inputs to the PLC are the output from 3 sensors. The inputs are named as
I0.0, I0.1 and I0.2 respectively. The PLC output is taken in the port 0.0 and it is
given to the solenoid. The programme is written in ladder logic in such a way
that, if any two of the three inputs goes to PLC the output is got from the PLC.

WORKING OF THE CYLINDER

When the work piece is placed in its position, if it is in correct position any two of
the three sensors will sense the work piece and this is given as input to the PLC.
Due to this an output is obtained from the PLC which energizes the solenoid.
This leads to actuate the DC valve and finally the cylinder.

RESULT

The given circuit is designed, programmed and tried successfully.

32
Shanmugam M
9. PLC Controlled Electro Pneumatic Circuit

33
Shanmugam M
DESIGN OF SIMPLE HYDRAULIC CIRCUIT

EXP NO: 10 DATE:


PROBLEM

Design a hydraulic circuit for forward and return motion of a cylinder by


manually operating a switch. The return stroke speed to be controlled.

AIM

To design a hydraulic circuit to create forward and return motion of a cylinder.

APPARATUS REQUIRED

 Double acting cylinder


 4/2 direction control
 valve control valve
Flow
 Hydraulic power pack
 Relief valve & Pressure
gauge
CIRCUIT DESCRIPTION

The hydraulic circuit is designed with the components available in the


hydraulic trainer kit. The double acting cylinder is connected to the direction
control valve through hoses. The piston end of the cylinder is connected
through the flow control valve to DC valve. The pump is connected to the DC
valve through a termination block. Required pressure relief valve and pressure
gauge are properly connected in the circuit.

WORKING OF THE CYLINDER

Pressurized oil from the pump is given to the DC valve through the relief
valve. If the manually operated valve is pressed, the oil flows to one side of the
cylinder depending on the connection and the cylinder makes its movement.
During return stroke the oil is allowed to come out through the flow control
valve and this controls the speed (like meter out valve) of the cylinder in the
return stroke.

RESULT

The given circuit is designed, constructed with the available components and
checked for working.

34
Shanmugam M
10. Simple Hydraulic Circuit

35
Shanmugam M
HYDRAULIC CIRCUIT USING HYDRAULIC MOTOR

EXPT NO: 11 DATE:


PROBLEM

Design a hydraulic circuit to operate hydraulic motor. The hydraulic motor is


used to move an industrial winch, which is placed in a slope. The downward
motion is caused by the clockwise movement of the motor and its speed should
be controlled against the weight of the winch.

AIM

To design the above said circuit.

APPARATUS REQUIRED

 Hydraulic Bi-directional motor


 Direction control valve (Double Solenoid)
 Meter out valve
 Hydraulic power pack and relief valve

CIRCUIT DESCRIPTION

The two ports of the direction control valve is connected to the two input ports
of the hydraulic motor. The valve used here is closed centre, solenoid operated
string return 4/3 valve. The pressurized oil and tank are connected to the
centre position of the DC valve. When one push button (PB1) is operated
solenoid A is energized and when another push button (PB2) is pressed,
solenoid B is energized. They generate clockwise and anticlockwise movement
in the motor respectively. The pressure line is fitted with a relief valve for
safety.

WORKING OF THE CYLINDER

The pressurized oil from the pump initially goes to the DC valve and when the
valve is in neutral position, oil cannot go anywhere because the valve is closed.
So the pressure developed will be more than the set pressure of the relief valve
and the oil will be relieved to the tank through relief valve. When PB1 is
pressed, the solenoid A energizes and the oil go to the motor and create
clockwise rotation in the motor. If the PB1 is released, then the spring takes
the valve to its neutral position. Now the motion of the motor stops. When PB2
is pressed, the oil is directed by DC valve, in such a way that it creates
anticlockwise rotation in the motor.

RESULT
Given circuit is designed, constructed and checked successfully.

36
Shanmugam M
11. Hydraulic Circuit using Hydraulic motor

37
Shanmugam M
STUDY AND ANALYSIS OF HYDRAULIC SYSTEM MODEL USING
MATLAB SOFTWARE

EXP NO: 12 DATE:

AIM:

To study and analysis of hydraulic system model using MATLAB software.

SOFTWARE USED:

 MATLAB 7.0

PROCEDURE:

1. Open MATLAB software in computer


2. Click start button which is available in left bottom side of the window
and select simulink in the pop-up menu.
3. In simulink select demos.
4. In simulink demos select automotive or aerospace.
5. In that, open hydraulic system models. A single hydraulic cylinder
model will be displayed in the window.
6. The model consists of pump, control valve orifice area, control valve,
cylinder, and piston and spring assembly.
7. By double clicking every component in the model, the parameters of
that component can be changed.
8. Double click on the pump and change time and pump flow values
according to the need and run the simulation for 0.1 seconds.
9. Take the output characteristics of single cylinder model obtained from
the simulation.
10. The characteristics of flow control valve and cylinder also can be
changed in the same way and do it if necessary.
11. By selecting the 4 cylinder model icon, 4 cylinder models can be opened
in new window and necessary parameter input can be given to make
simulation.
12. By selecting the 2 cylinder model icon, which can be opened in new
window and study can be done.

RESULT:

Thus the analysis of hydraulic system model using MATLAB for a given set of
parameters was studied and output characteristics of the given model were
taken by simulation.

38
Shanmugam M
12. Hydraulic cylinder model

39
Shanmugam M
Figure: Pressure
Variation

Figure: Piston Position

40
Shanmugam M
ASSEMBLY LANGUAGE PROGRAMMING OF 8085
MICROPROCESSOR FOR SIMPLE ARITHMETIC OPERATIONS

EXPT NO: 13 DATE:


AIM:
To write an assembly language program to add, subtract, multiply and
divide the given data stored at another memory locations using 8085
microprocessor.

a. 8 BIT DATA ADDITION:

OBJECTIVE
To add two 8 - bit numbers in memory and store the result in memory.
Theory:

The first data is brought to Accumulator A and the second one in any one of the
other registers, say B. The addition is done using ADD. The result is then stored
at 4152. The ADD instruction affects flags depending on result.
Example: The two data to be added are at 4150 and 4151. The result is stored at
4152.
Data : (4150) = 23
(4151) = 35
Result : (4152) = 58.

FLOW CHART

41
Shanmugam M
PROGRAM
LDA 4150 ; (4150) => (A) = 23
MOV B,A ; (A) => (B)
LDA 4151 ; (4151) => (A) = 35
ADD B ; (A) + (B) => (A)
STA 4152 ; (A) => (4152) = 58
HLT

OBJECT CODES

PROCEDURE:
1. Key in the opcodes from the address specified.
2. Enter data at 4150 and 4151 as specified in the Example.
3. Execute the program and check for the result at 4152.
4. Change data at 4150 and 4151 and execute each time and check for result.
8 BIT DATA SUBTRACTION

OBJECTIVE
To subtract two 8-bit numbers in memory and to store the result also in memory.
THEORY
In this experiment, the HL register pair is first initialized to the start address of
memory at which

42
Shanmugam M
the data is stored. Then data is brought to accumulator A and the other one is
subtracted from
memory itself. The result from A is then stored into memory again using the HL
register. The
SUB instruction sets and clears flags according to result.
EXAMPLE
Let the data to be subtracted be 24 from 49.
Data : (4150) = 49
4151) = 24
Result : (4152) = 25
FLOW CHART

PROGRAM
LXI H, 4150 ; Initialise memory pointer to 4150
MOV A, M ; (4150) => (A) = 49
INX H ; Point to next data.
SUB M ; (4151) => (A)
INX H ; Point to next location.
MOV M,A ; (A) => (4152)
HLT ;

43
Shanmugam M
OBJECT CODES

PROCEDURE
1. Key in the opcodes from the address specified.
2. Enter data that is needed for execution at 4150 and 4151.
3. Execute the program and check for results at 4152.
4. Try changing data and check for results each time.

8 - BIT MULTIPLICATION
THEORY

Multiplication can be done by repeated addition while division by repeated


subtraction.
In this experiment, the multiplicand and the multiplier stored at memory
locations are taken up by the register pair DE and register B. Using the DAD
instruction, 16-bit addition is done
repeatedly by the multiplicand until the multiplier becomes zero. The result is
again stored in
a memory location.
EXAMPLE
Let the multiplicand and the multiplier be at locations 4150 and 4152. The result
will be stored at location 4154. The data at locations are:
Data : (4150) = 93 (4152) = 23
(4151) = 00 (4153) = 00
Result : (4154) = 19

44
Shanmugam M
(4155) = 14
93 x 23 = 1419.
FLOW CHART

PROGRAM
LDA 4152 ;Load Multiplier
MOV B,A ;Get the multiplier to B
LXI D, 0000
LHLD 4150 ;
XCHG ;Load multiplicand in DE
LOOP : DAD D
DCR B
JNZ LOOP ;If not zero loop again.
SHLD 4154 ;Else store result.
HLT

45
Shanmugam M
OBJECT CODES

PROCEDURE
1. Key in the opcodes from the address specified.
2. Enter data at 4150 through 4153 for execution.
3. Execute the program and check for results at 4154 and 4155.
4. Try changing data and check results each time.

46
Shanmugam M
8 -BIT DIVISION

OBJECTIVE
To divide two 8- bit numbers and to store the result in memory again.
THEORY
Division is done here using the method of repeated subtraction. The dividend is
loaded to
register A and divisor to register B. Subtract divisor from dividend until the
dividend is less than
the divisor. Count number of times of subtraction. That count is the quotient and
the dividend
now becomes the remainder.
EXAMPLE
The divisor and the dividend are at locations 4150 & 4151. The quotient &
remainder will be
stored at locations 4152 & 4153.
Data : (4150) = 08 - Divisor
(4151) = 2A - Dividend.
Result : (4152) = 02 - Remainder
(4153) = 05 - Quotient.
FLOW CHART

47
Shanmugam M
PROGRAM
LDA 4150 ; Load divisor
MOV B,A ; to B.
LDA 4151 ; Load dividend to A.
MVI C,00 ; Initialise quotient = 0.
CMP B
JC LOOP
LOOP1: SUB B ; Dividend - Divisor.
INR C ; Quotient = Quotient + 1.
CMP B ; Is Dividend < Divisor.
JNC LOOP1 ; If not repeat again.
LOOP : STA 4152 ; Yes, then store remainder.
MOV A,C
STA 4153 ; Store quotient.
HLT
OBJECT CODES

PROCEDURE
1. Key in the opcodes from the address specified.

48
Shanmugam M
2. Enter data for execution at 4150 and 4151.
3. Execute the program and check for results at 4152 and 4153.
4. Try changing data and check for results each time you execute.
OBSERVATION:
ADDITION:

S.NO INPU OUTPUT


T
ADDRESS DATA ADDRESS DATA
1 4500 4502
4501 4503
2 4500 4502
4501 4503

SUBTRACTION:

S.NO INPU OUTPUT


T
ADDRESS DATA ADDRESS DATA
1 4500 4502
4501 4503
2 4500 4502
4501 4503

MULTIPLICATION:

S.NO INPU OUTPUT


T
ADDRESS DATA ADDRESS DATA
1 4500 4502
4501 4503
2 4500 4502
4501 4503

DIVISION:

S.NO INPU OUTPUT


ADDRESS
T DATA ADDRESS DATA
1 4500 4502
4501 4503
2 4500 4502
4501 4503
RESULT:

Thus the addition, subtraction, multiplication and division of two numbers was
performed using the 8085 microprocessor.

49
Shanmugam M
ASSEMBLY LANGUAGE PROGRAMMING OF 8085 MICROPROCESSOR
FOR SORTING

EXPT NO: 14 DATE:


AIM:
To write an assembly language program to arrange an array of data
in ascending and descending order and to find the smallest and largest data
among the array.
a. ASCENDING ORDER

ALGORITHM:

1. Get the numbers to be sorted from the memory locations.


2. Compare the first two numbers and if the first number is larger
than second then I interchange the number.
3. If the first number is smaller, go to step 4
4. Repeat steps 2 and 3 until the numbers are in required order
EXERCISE
1. Arrange the given array of numbers in ascending order; the length of the array
is at
memory location 4150, while the array itself starts from 4151.
Sample problem
Data : (4150) = 07 - No. of elements.
(4151) = 06 - Array starts.
(4152) = 68
(4153) = F2
(4154) = 87
(4155) = 30
(4156) = 59
(4157) = 2A
Result : (4151) = 06
4152) = 2A
(4153) = 30
(4154) = 59
(4155) = 68
(4156) = 87
PROGRAM
START : MVI B,00 ; Flag = 0
LXI H ,4150 ; Count = Length of array
MOV C,M
DCR C ; Number of pairs = Count - 1
INX H ; Point to start of array
LOOP : MOV A,M ; Get Kth element
INX H
CMP M ; Compare to (K+1)th element

50
Shanmugam M
JNC LOOP1 ; No interchange
if Kth >= (K+1)th
MOV D,M ; Interchange if out of order
MOV M,A
DCX H
MOV M,D
INX H
MVI B,01 ; Flag = 1
LOOP1 : DCR C ; Count down
JNZ LOOP
DCR B ; Is Flag = 1 ?
JZ START ; Do another sort, if yes
HLT ; If FLAG = 0, stop execution
OBJECT CODES

PROCEDURE
1. Key in the opcodes from the address specified.
2. Enter data for execution from 4150 through 4156.
3. Execute the program and check for results.
4. Try changing data and repeat again.

51
Shanmugam M
ARRANGE IN DESCENDING ORDER
ALGORITHM:

1. Get the numbers to be sorted from the memory locations.


2. Compare the first two numbers and if the first number is smaller
than second then I interchange the number.
3. If the first number is larger, go to step 4
4. Repeat steps 2 and 3 until the numbers are in required order
EXAMPLE
The length of the array is at memory location 4150 which is assumed to be 06.
The array starts
from 4151.
Data : (4150) = 06 - No. of elements.
(4151) = 2A - Array starts.
(4152) = B5
(4153) = 60
(4154) = 3F
(4155) = D1
(4156) = 19
Result : (4151) = D1
(4152) = B5
(4153) = 60
(4154) = 3F
(4155) = 2A
(4156) = 19
PROGRAM
START : MVI B,00 ; Flag = 0
LXI H ,4150 ; Count = Length of array
MOV C,M
DCR C ; Number of pairs = Count - 1
INX H ; Point to start of array
LOOP : MOV A,M ; Get Kth element
INX H
CMP M ; Compare to (K+1)th element
JNC LOOP1 ; No interchange
if Kth >= (K+1)th
MOV D,M ; Interchange if out of order
MOV M,A
DCX H
MOV M,D
INX H
MVI B,01 ; Flag = 1
LOOP1 : DCR C ; Count down
JNZ LOOP
DCR B ; Is Flag = 1 ?
JZ START ; Do another sort, if yes
HLT ; If FLAG = 0, stop execution

52
Shanmugam M
FLOW CHART

53
Shanmugam M
OBJECT CODES

PROCEDURE
1. Key in the opcodes from the address specified.
2. Enter data for execution from 4150 through 4156.
3. Execute the program and check for results.
4. Try changing data and repeat again.

OBSERVATION:

A. ASCENDING ORDER

INPUT OUTPU
MEMORY DATA MEMORYT DATA
LOCATIO LOCATIO
4200
N N 420
4201 0
420
4202 1
420
4203 2
420
4204 3
420
4

54
Shanmugam M
B. DESCENDING ORDER

INPUT OUTPU
MEMORY DATA MEMORYT DATA
LOCATIO LOCATIO
4200
N N 420
4201 0
420
4202 1
420
4203 2
420
4204 3
420
4

RESULT:

Thus the sorting operations of arranging an array in ascending and


descending order were found using the 8085 microprocessor.

55
Shanmugam M
ASSEMBLY LANGUAGE PROGRAMMING OF 8085 MICROPROCESSOR
FOR CODE CONVERSION

EXPT NO: 15 DATE:


AIM:
To write an assembly language program to perform the
conversions of ASCII to hexadecimal number, hexadecimal to decimal
number, binary to hexadecimal number and hexadecimal to binary
number.

(a) ASCII TO DECIMAL CONVERSION:


OBJECTIVE
To convert the ASCII number in memory to its equivalent decimal number.
THEORY
Conversion of an ASCII number to decimal is very simple because all the decimal
numbers form
a sequence in ASCII. Any ASCII number can be converted to decimal just by
subtracting 30
from it.

EXAMPLE
Let the ASCII number be at location 4150 and the result be stored at 4151.
Data : (4150) = 35
Result : (4151) = 05.
Data : (4150) = 3A
Result : (4151) = FF.
So if the decimal number got is not a valid one, FF will be stored as the result to
indicate the
error.

56
Shanmugam M
FLOW CHART FOR ASCII TO DECIMAL

PROGRAM
LXI H, 4150 ; Point to data.
MOV A, M ; Get operand.
SUI 30 ; Convert to decimal.
CPI 0A ; Check whether it is a valid decimal number.
JC LOOP ; Yes, store result.
MVI A,FF ; No, make result = FF.
LOOP :INX H
MOV M, A
HLT ; (A) => (4151)
OBJECT CODES

57
Shanmugam M
PROCEDURE
1. Key in the opcodes from the address specified.
2. Enter data at 4150.
3. Execute the program and check at 4151 for result.
4. Try changing data and check result each time at 4151.
(b) BCD TO HEX CONVERSION
OBJECTIVE
To convert two BCD numbers in memory to the equivalent hex number.
THEORY
Out of the two BCD digits at 4150 and 4151, the one at 4150 is the MSD. The
logic is to
multiply the MSD by ten using repeated addition. Then add the LSD to it.
EXAMPLE
The BCD digits are at locations 4150 and 4151 and result will be stored at 4152.
Data : (4150) = 02 (MSD)
(4151) = 09 (LSD)
Result : (4152) = 1D H = 29 D
FLOW CHART

PROGRAM
LXI H, 4150 ; Initialise memory pointer to 4150
MOV A, M ; (A) = (4150) - (MSD)
ADD A ; MSD X 2.
MOV B,A ; Save MSD X 2.
ADD A ; MSD X 4.
ADD A ; MSD X 8.
ADD B ; MSD X 10.

58
Shanmugam M
INX H ; Point to LSD
ADD M ; Add to form hex equivalent.
INX H ; (A) => (4152)
MOV M, A
HLT
OBJECT CODES

PROCEDURE
1. Key in the opcodes from the address specified.
2. Enter data at 4150 and 4151 for execution.
3. Execute the program and check for result at 4152.
4. Try changing data and check result each time.

(c) HEX TO DECIMAL CONVERSION:

OBJECTIVE
To convert the hex number in memory to its equivalent decimal number.

THEORY
In this experiment, the hex number is converted to its equivalent decimal
number using the
following logic. First count the number of hundreds, the number of tens and
units present in that
hex number. Using these three, add up to get the equivalent decimal number.
For example, take

59
Shanmugam M
the hex number A9 and converting it we get
A9
- 64 Hundreds = 01
45
Sine 64 (100 decimal) cannot be subtracted from 45, number of hundreds = 01.
Now count tens.
45
- 0A Tens = 01
3b
- 0A Tens = 02
31
- 0A Tens = 03
27
- 0A Tens = 04
1d
- 0A Tens = 05
13
- 0A Tens = 06
09
Now from 09, 0A cannot be subtracted. Hence tens = 06. Therefore the decimal
equivalent of
A9 is 169.

EXAMPLE
Let us work with A9 in this program.
Data : (4150) = A9
Result : (4151) = 01
(4152) = 69
A9 H = 169 D

60
Shanmugam M
FLOW CHART

61
Shanmugam M
PROGRAM
LXI H, 4150 ;Point to data.
LXI B, 0000 ;Initialise Hundreds = 0,
Tens = 0.
MOV A, M ;Get hex data to A.
LOOP : SUI 64
JC LOOP1
INR B ;Hundreds = Hundreds + 1.
JMP LOOP
LOOP1 :ADI 64 ;If subtracted extra, add it clear carry flag.
LOOP2 :SUI 0A
JC LOOP3
INR C ;Tens = Tens + 1.
JMP LOOP2
LOOP3 :ADI 0A ; If subtracted extra, add it again.
INX H ; A = Units.
MOV M,B ; Store Hundreds.
MOV B,A ; Combine Tens in C and
MOV A,C ; units in A to form a
RLC ; single 8-bit number.
RLC
RLC
RLC
ADD B
INX H
MOV M, A ; Store Tens and units.
HLT

62
Shanmugam M
OBJECT CODES

PROCEDURE
1. Key in the opcodes from the address.
2. Enter data at 4150 for execution.
3. Execute the program and check for result.
4. Try changing data and check for result at 4151 and 4152 each time.

63
Shanmugam M
(d) HEX TO BINARY FORM

OBJECTIVE
To convert an 8-bit hex number to its binary form and store in memory.

THEORY
First get the data and rotate it right. Depending upon carry store either 0 or 1 in
memory. Do the
rotation 8 times for the 8 bits in that number.

EXAMPLE
Let the data be 5A.
Data : 5A = 0101 1010 B
Result : (4150) = 0 (LSB)
(4151) = 1
(4152) = 0
(4153) = 1
(4154) = 1
(4155) = 0
(4156) = 1
(4157) = 0 (MSB)

PROGRAM
LXI H,4150 ; Initialise Memory pointer
MVI B,08 ; Counter for 8-bits
MVI A,5A
LOOP :RRC ; Check least significant bit
JC LOOP1
MVI M,00 ; Store zero if no carry
JMP COMMON
LOOP1:MVI M,01 ; Store one if there is a carry
COMMON: INX H
DCR B ; Check for counter
JNZ LOOP
HLT

64
Shanmugam M
OBJECT CODES

PROCEDURE
1. Key in the opcodes from the address specified.
2. Execute the program and check for results at locations 4150 through 4157.
3. Try changing data and check for results each time.

OBSERVATION:
a. ASCII TO DECIMAL

INPUT OUTPU
MEMORY DATA MEMORYT DATA
LOCATIO LOCATIO
N 420 N 430
1 1

65
Shanmugam M
b. HEXADECIMAL TO BINARY

INPU OUTPU
MEMORY T DATA MEMOR T
DATA MEMORY DATA
LOCATIO Y LOCATIO
N 4200
LOCATIO 4204
N
4200 N 4201 4205
4202 4206
4203 4207

c. BINARY TO HEXADECIMAL

INPUT OUTPU
MEMORY DATA MEMORYT DATA
LOCATIO LOCATIO
N 415 N
0
415 415
1 2
d. HEXADECIMAL TO DECIMAL

INPUT OUTPU
MEMORY DATA MEMORYT DATA
LOCATIO LOCATIO
N 415 N
0
415 415
1 2

RESULT:
Thus the assembly language programs for various code conversions are
executed using 8085 microprocessor.

66
Shanmugam M
STUDY OF 8051 MICROCONTROLLER AND STEPPER MOTOR
EXPT NO: DATE:

AIM:
The study the fundamentals of 8051 microcontrollers and stepper motor.

MICROCONTROLLER:
A microcontroller is an integration of a microprocessor with memory and
input, output interfaces and other peripherals such as timers on a single chip.
A microcontroller may take an input from the device it is controlling and
control the device by sending signals to different components in the device.
A microcontroller is often small and low cost. The components may be
chosen to minimize size and to be as inexperience as possible.
Another name for a microcontroller is embedded controller. They can
control features or action of the product.

Register in microcontroller:
A microcontroller contains a group of registers each type of register having
a different functions.
Accumulator:
The accumulator (A) is an 8 bit register where data for an input to the
arithmetic and logic unit is temporarily stored. So the accumulator register is a
temporary handling register for data to be operated on by the arithmetic and
logic unit also after the operation the register for holding the result.

B Register:
In addition to accumulator an 8 bit B-register is available as a general
purpose register when it is not used for the hardware multiply/divide operation.
Data pointer (DPTR):
The data pointer consists of a high byte (DPH) and a low byte (DPL). Its
function is to hold a 16 bit address. It may be manipulated as a 16 bit data
register. It serves as a base register in direct jumps, lookup table instructions
and external data transfer.
Stack pointer:
The stack refers to an area of internal RAM that is used in conjunction
with certain opcode data to store and retrieve data quickly. The stack pointer
register is used, by the 8051 to hold as internal RAM that is called top of stock.
The stack pointer register is 8 bit wide. It is increased before data is stored
during PUSH and CALL instructions and decremented after data is restored
during POP and RET instruction. The stack pointer is initialized to 07H after a
reset. This causes the stack to begin at location 08H.
Program counter:

67
Shanmugam M
The 8051 has 16 bit program counter. It is used to hold the address of
memory location from which the instruction to be fetched. 8051 is a 16 bit hence
it can be address up to 216 byte i.e. 64k of memory. The PC is the only register
that does not have an internal address.
Internal RAM:
The 8051 has 128 bytes internal RAM. It is addressed using RAM address
register
 First thirty two bytes from address 00H to 1FH of internal RAM
constitute 32 working registers. They organized into four banks of eight
registers each. The four register banks are numbered 0 to 3 and consist of
eight registers named R0 to R7. Each register can be addressed by name
or by its RAM address.
 Only one register bank is in use at a time. Bits Rs0 and Rs1 in the PSW
determine which bank of register is currently in use.
 Register banks when not selected can be used as general purpose RAM.
PIN diagram of microcontroller:
The 8051 microcontroller is available in a 40 pin dual in-line (DIL)
package arrangement. It is important to note that many pins of 8051 are used for
more than one function.
The function of each of the pins is as follows.
PORT 0 (pins 32-39):
Port 0 pins can be used as I/O pins. The output drives and input buffers of
port 0 are used to access external memory address, time multiplexed with the
data being written or read. Thus port 0 can be used as multiplexed address data
bus.
PORT 1 (pins 1-8):
Port 1 pins can be used only as I/O pins.
PORT 2 (pins 21-28):
The output drives of port 2 are used to access external memory. Port 2
outputs the high order byte of the external memory address when the address is
16 bits wide otherwise port 2 is used as I/O ports.

PORT 3 (pins 10-17):


All ports pins of port-3 are multifunctional. They have special functions
including two external interrupts two counter two special data lines and two
timing control strobes.
Power supply pins Vcc and ground to pin Vcc with rated power supply
current of 125mA.
Oscillator Pins XTA2 (pin 18) and XTA1 (pin 19):
For generating an internal clock signal the external oscillator is connected
at these two pins.
ALE (address latch enable) Pin 30:

68
Shanmugam M
AD0 to AD7 lines are multiplexed. To determine these lines and for
obtaining lower half of an address, an external latch and ALE of 8051 is used.
RST (Reset pin 9):
This pin is used to reset 8051. For proper reset operation, reset signal
must be held high at least for two machine cycles, while oscillator is running.
PSEN (Program Store Enable pin29):
It is the active low output control signal used to activate the enable signal
if the external ROM/EPROM. It is activated every six oscillator periods while
reading the external memory.
Thus this signal acts as the read store to external program memory.

STEPPER MOTOR
A motor in which the rotor is able to assume only discrete stationary
angular position is a stepper motor. The rotary motion occurs in a stepwise
manner from one equilibrium position to the next.

Construction features:
A stepper motor could be either of the reluctance type of or permanent
magnet type. A PM motor consists of multiphase stator and two part permanent
magnet rotor variable reluctance motor has magnetized rotor. PM stepper motor
is the most commonly used type. The basic two phase stepper motor consists of
two pairs of stator poles. Each of four poles has its own winding.
The excitation of any one winding generates a north pole and a South Pole
gets attracted and the torque induced at the diametrically opposite side. The
rotor magnetic system has two end faces.
The left face is permanently magnetized as south and the right face as
North Pole faces.
The north pole structure is twisted with respect to the south pole structure
so that south pole precisely between two north poles. In an arrangement where
there are four stator poles and three pairs of rotor poles, there exist 12 possible
stable position in which a south pole if the rotor can lock with a north pole of the
stator. From this is can be noted that the step size is
= 360 (Ns*Nr)
Ns number of stator pole
Nr number of pairs of rotor poles
Generally step size of the stepper motor depends up on rotor poles. There
are three different schemes available for stepping a motor. They are
1. Wave scheme
2. 2 phase scheme
3. Half stepping or missed scheme

69
Shanmugam M
Wave switching scheme:
Anticlock wise Clock wise
Step A1 A2 B1 B2 Step A1 A2 B1 B2
1 1 0 0 0 1 1 0 0 0
2 0 0 0 1 2 0 0 1 0
3 0 1 0 0 3 0 1 0 0
4 0 0 1 0 4 0 0 0 0

Two phase switching scheme:


Anticlock wise Clock wise
Step A1 A2 B1 B2 Step A1 A2 B1 B2
1 1 0 0 1 1 1 0 1 0
2 0 1 0 1 2 0 1 1 0
3 0 1 1 0 3 0 1 0 1
4 1 0 1 0 4 1 0 0 1

REPRESENTATION:

Operational features of stepper motor:


There are many kinds of stepper motor like unipolar type, bipolar type,
single phase type, multiphase type; single phase stepper motor is often used for
quartz watch. In PM type stepper motor, a permanent magnet is used for motor
and coils are put on stator. The stepper motor model which has 4 poles at top,
bottom and at either sides. X coil, X¯ coil, r coil and r¯ coil are put to the upper
side and the lower pole. r coil and r¯ coil are rolled up for the direction of the pole
becomes opposite when applying an electric current to the r¯ coil. It is similar
about X and X¯ too. The turn of the motor is controlled by the electric current

70
Shanmugam M
which pairs into X, X¯, r, r¯. The rotor rotational speed and the direction of turn
can be controlled by this control.
Speed control of a stepper motor:
The requirement is to use a microcontroller to drive a stepper motor in
both forward and reverse directions of shaft rotation and to implement a two
speed arrangement switches are to be used to produce the two speeds and a
reversal of shaft rotation.
Generally a stepper motor has four sets of coils; one end of each coil may
be connected together and then connected to DC supply. The remaining four ends
may be driven through transistors either separately or in integrated circuit form.
A four bit code sequence continuously applied to the drive circuit from the
microcontroller port causes the motor shaft to rotate in angular steps. Stepper
motor has step angles of 1.8 degree step revolution and turning force may be
improved by using a step down gear box. The stepping code sequence may be
obtained from the motor manufacturer or distributor. The program in this
example was a common four step sequence of A,9,5,6 that it sent continuously
would cause the motor shaft to rotate.

RESULT:
Thus the fundamentals of microcontroller and stepper motor were studied

71
Shanmugam M
RUN THE STEPPER MOTOR AT DIFFERENT SPEED
EXPT NO: 16a DATE:
AIM:
To run a stepper motor at different speed by using 8051 assemble
language
APPARATUS REQUIRED:
 Stepper Motor
 Interface Board
PROCEDURE:
1. Switch ON the micro controller
2. Initialize the starting address
3. Enter the mnemonics code in the microcontroller
4. Reset the microcontroller
5. Execute the program
PROGRAM:
TO RUN A STEPPER AT DIFFRENT SPEED IN BOTH PORTS

4100 ORG 4100H


4100 90 45 00 START : MOV DPTR,
4103 78 04 MOV #4500H
R0, #04H
4105 E0 J0 : MOVX A, @DPTR
4106 FC MOV R4, A
4107 C0 83 PUSH DPH
4109 C0 82 PUSH DPL
410B 90 FF C0 MOV DPTR,
410E F0 MOVX #FFC0H A
@DPTR,
410F 12 41 23 LCALL DELAY
4112 90 FF C8 MOV DPTR,
4115 EC MOV #FFC8H
A, R4
4116 F0 MOVX @DPTR, A
4117 12 41 23 LCALL DELAY
411A D0 82 POP DPL
411C D0 83 POP DPH
411E A3 INC DPTR
411F D8 E4 DJNZ R0, J0
4121 80 DD SJMP START
4123 DELAY :
4123 7A 04 MOV R2, #04H
4125 L0 :
4125 79 FF MOV R1, #FFH
4127 L1 :
4127 7B FF MOV R3, #FFH
4129 L2 :
4129 DB FE DJNZ R3, L2
412B D9 FA DJNZ R1, L1
412D DA F6 DJNZ R2, L0

72
Shanmugam M
412F 22 RET
4130 END
4500 09, 05, 06, 0A TABLE: DB 09, 05, 06, 0A

RESULT:
Thus the program to run the stepper motor at different speed was derived
using 8051 assembles language and was verified.

73
Shanmugam M
RUN THE STEPPER MOTOR IN FORWARD AND REVERSE
DIRECTION
EXPT NO: 16b DATE:

AIM:
To run a stepper motor in forward and reverse rotation using 8051
assembly language

APPARATUS REQUIRED:
 Stepper Motor
 Interface Board

PROCEDURE:
1. Switch ON the micro controller
2. Initialize the starting address
3. Enter the mnemonics code in the microcontroller
4. Reset the microcontroller
5. Execute the program

PROGRAM:
PROGRAM FOR FORWARD & REVERSE ROTATION IN 8051

PAGE1

4100 1 ORG 4100H

2 $MOD52
4100 7C33 3 START : MOV R4, #33H
4102 904144 4 L2 : MOV DPTR, #FORWARD
4105 12411C 5 LCALL L1
4108 DCF8 6 DJNZ R4, L2
410A 124113B 7 LCALL DELAY
410D 7C33 8 MOV R4, #33H
410F 904148 9 L3 : MOV DPTR, # REVERSE
4112 12411C 10 LCALL L1
4115 DCF8 11 DJNZ R4, L3
4117 12413B 12 LCALL DELAY
411A 80E4 13 SLMP START
411C 7804 14 L1 : MOV R0, #04H
411E E0 15 LOOP : MOVX A, @DPTR
411F C083 16 PUSH 83H
4121 C082 17 PUSH 82H
4123 90FFC0 18 MOV DPTR,
4126 7A04 19 MOV #OFFCOH
R2, #04H

74
Shanmugam M
4128 7905 20 L7 : MOV R1, # 05H
412A 7BFF 21 L6 : MOV R3, # 0FFH
412C DBFE 22 L4 : DJNZ R3, L4
412E D9FA 23 DJNZ R1, L6
4130 DAF6 24 DJNZ R2, L7
4132 F0 25 MOVX @DPTR, A
4133 D082 26 POP 82H
4135 D083 27 POP 83H
4137 A3 28 INC DPTR
4138 D8E4 29 DJNZ R0, LOOP
413A 22 30 RET
413B 7D01 31 DELAY : MOV R5, #01H
413D 7A05 32 L9 : MOV R2, #01H
413F DAFE 33 L8 : DJNZ R2, L8
4141 DDFA 34 DJNZ R5, L9
4143 22 35 RET
4144 0905060A 36 FORWARD : DB 09H, 05H, 06H, 0AH
414B 0A060509 37 REVERSE : DB 0AH, 06H, 05H, 09H

RESULT:
Thus the program to rotate the stepper motor in forward and reverse direction
was derived using 8051 assemble language and was verified.

75
Shanmugam M
TRAFFIC LIGHT CONTROLLERS WITH 8085

EXPT NO: 17 DATE:

AIM:

To write an assembly language program to simulate the traffic light at an


intersection using a traffic light interface.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY


1 Microprocessor kit 4185,Vi Microsystems 1
2 Power supply +5 V dc 1
3 Traffic light interface Vi Microsystems 1
kit
ALGORITHM:
1. Initialize the ports.
2. Initialize the memory content, with some address to the data.
3. Read data for each sequence from the memory and display it through
the ports.
4. After completing all the sequences, repeat from step2.

A SAMPLE SEQUENCE:
1. (a) Vehicles from south can go to straight or left.
(b) Vehicles from west can cross the road.
(c) Each pedestrian can cross the road.
(d) Vehicles from east no movement.
(e) Vehicles from north can go only straight.

2. All ambers are ON, indicating the change of sequence.

3. (a) Vehicles from east can go straight and left.


(b) Vehicles from south can go only left.
(c) North pedestrian can cross the road.
(d) Vehicles from north, no movement.
(e) Vehicles from west can go only straight.

4. All ambers are ON, indicating the change of sequence.

5. (a) Vehicles from north can go straight and left.


(b) Vehicles from east can go only left.
(c) West pedestrian can cross the road.
(d) Vehicles from west, no movement.
(e) Vehicles from south can go only straight.

6. All ambers are ON, indicating the change of sequence.


7. (a) Vehicles from west can go straight and left.

76
Shanmugam M
(b) Vehicles from north can go only left.
(c) South pedestrian can cross the road.
(d) Vehicles from south, no movement.
(e) Vehicles from east can go only straight.

8. All ambers are ON, indicating the change of sequence.

9. (a) All vehicles from all directions no movement.


(b) All pedestrian can cross the road.

BIT ALLOCATION:

BIT LED BIT LED BIT LED

PA0 SOUTH LEFT PB0 NORTH LEFT PC0 WEST STRAIGHT


PA1 SOUTH RIGHT PB1 NORTH RIGHT PC1 NORTH STRAIGHT
PA2 SOUTH AMBER PB2 NORTH AMBER PC2 EAST STRAIGHT
PA3 SOUTH RED PB3 NORTH RED PC3 SOUTH STRAIGHT
PA4 EAST LEFT PB4 WEST LEFT PC4 NORTH PD
PA5 EAST RIGHT PB5 WEST RIGHT PC5 WEST PD
PA6 EAST AMBER PB6 WEST AMBER PC6 SOUTH PD
PA7 EAST RED PB7 WEST RED PC7 EAST PD

PATH REPRESENTATION:

77
Shanmugam M
CONTROL ----- 0F (FOR
8255 PPI) PORT A -----
0C
PORT B ----- 0D
PORT C ----- 0E
PROGRAM:

ADD OPCODE LABEL MNEMON OPERA COMMENT


RES ICS ND
4100
S 3E MVI A, 41 Move 41H immediately
to accumulator

4102 D3 OUT 0F Output contents


of
4104 REPEAT LXI H,DATA Load address
accumulator 417B
to OF portto
_ SQ HL register

4107 11 LXI D,DATA Load address 4187 to


_E DE register
410A CD CALL OUT Call out address 4142
410D EB XCHG Exchange contents of
HL with DE pair
410E 7E MOV A, M Move M content
to accumulator
410F D3 OUT 0D Load port A into output
4111 CD CALL DELAY1 port
Call delay address
4114 EB XCHG Exchange content of HL
with DE pair
4115 13 INX D Increment the content
4116 23 INX H of D
Increment the content
4117 CD CALL OUT of H out the address
Call
411A EB XCHG Exchange content of HL
with DE pair
411B 7E MOV A, M Move M content
to accumulator
411C D3 OUT 0D Load port B into output
411E CD CALL DELAY1 port DELAY address
Call
4121 EB XCHG Exchange content of HL
with DE pair
4122 13 INX D Increment D register
4123 23 INX H Increment H register
4124 CD CALL OUT Call specified address
4127 EB XCHG Exchange content of HL
with DE pair

78
Shanmugam M
4128 7E MOV A, M Move M content
to accumulator
4129 D3 OUT 0E Load port C into output
412B CD CALL DELAY1 port DELAY address
Call
412E EB XCHG Exchange content of HL
with DE pair
412F 13 INX D Increment D register
4130 23 INX H Increment H register
4131 CD CALL OUT Call specified address
4134 EB XCHG Exchange content of HL
with DE pair
4135 7E MOV A, M Move M content
to accumulator
4136 D3 OUT 0E Load port C into output
4138 23 INX H port
Increment H register
4139 7E MOV A, M Move M content
to accumulator
413A D3 OUT 0C Load port A into output
413C CD CALL DELAY1 port
Call DELAY address
413F C3 JMP REPEA Jump to specified
4142 7E OUT MOV T M
A, address M content
Move
to accumulator
4143 D3 OUT 0E Load port C into output
4145 23 INX H port
Increment H register
4146 7E MOV A, M Move M content
to accumulator
4147 D3 OUT 0D Load port B into output
4149 23 INX H port
Increment H register
414A 7E MOV A, M Move M content
to accumulator
414B D3 OUT 0C Load port A into output
414D CD CALL DELAY port DELAY address
Call
4150 C9 RET Return to accumulator
4151 E5 DELAY PUSH H Push the register H
4152 21 LXI H,001F Load 00 1F in HL
register pair
4155 01 LXI B,FFFF Load FF FF in DE
register pair
4158 0B DCX B Decrement B register
4159 78 MOV A, B Move B content
to accumulator
415A B1 ORA C OR content of C
with accumulator
415B C2 JNZ LOOP Jump to LOOP if no
415 2B DCX H zero
Decrement H register
E
415F 7D MOV A, L Move L content
to accumulator
4160 B4 ORA H OR content of H
with accumulator

79
Shanmugam M
4161 C2 JNZ L1 Jump to L1 if no zero
4164 E1 POP H Pop the register H
4165 C9 RET Return from subroutine
4166 E5 DELAY PUSH H Push the register H
4167 21 1 LXI H,001F Load 00 1F in HL
register pair
416A 01 LXI B,FFFF Load FF FF in DE
register pair
416D 0B DCX B Decrement B register
416E 78 MOV A, B Move B conten to
accumulat t
416F B1 ORA C OR
or of C wit
conte h
4170 C2 JNZ LOOP2 Jump
nt to LOOP2 if no
4173 2B DCX H zero
Decrement
accumulatorH register
4174 7D MOV A, L Move L conten to
accumulat t
4175 B4 ORA H OR
or of H wit
conte h
4176 C2 JNZ L2 Jump
nt to L2 if no zero
4179 E1 POP H Pop the register H
accumulator
417A C9 RET Return to subroutine
417B 12 27 44 10 DATA
2B 92 10 9D SEQ
84 48 2E 84 DB
4187 48 4B 20 49 DATA_
04 E

RESULT:
Thus an assembly language program to simulate the traffic light at an
intersection using a traffic light interfaces was written and implemented.

80
Shanmugam M
SPEED CONTROL OF DC MOTOR
EXPT NO: 18 DATE:
AIM:
To control the speed of the PMDC motor using Versamax Micro PLC.
APPARATUS REQUIRED:
 Speed Control Module Trainer
 Versamax Micro PLC
 PC
 RS-232 Cable
 12V DC Motor
 Patch chords
THEORY
Anatomy Of A Feedback Control System

PID CONTROLLER
One of the most powerful but complex controller mode operations combines the
proportional, integral and derivative mode. This system can be used for virtually
any process condition. The block diagram of a PID controller is,

A PID controller continuously calculates an error value as the difference between


a desired setpoint and a measured process variable. The controller attempts to
minimize the error over time by adjustment of a control variable. The ideal
version of the PID controller is given by the formula,

81
Shanmugam M
The variable ( ) represents the tracking error, the difference between the
desired input value ( ) and the actual output ( ). This error signal ( ) will be sent
to the PID controller, and the controller computes both the derivative and the
integral of this error signal. The control signal ( ) to the plant is equal to the
proportional gain ( ) times the magnitude of the error plus the integral gain (
) times the integral of the error plus the derivative gain ( ) times the derivative
of the error.

This control signal ( ) is sent to the plant, and the new output ( ) is obtained.
The new output ( ) is then fed back and compared to the reference to find the
new error signal ( ). The controller takes this new error signal and computes its
derivative and its integral again, ad infinitum

PROCEDURE:
1. Load the versapro software in PC
2. Open the versapro software.
3. PLC kit is switches ON
4. Interface PC to PLC through RS-232 cable.
5. Open the new folder and draw the ladder logic program.
6. Connect the PLC
7. Select the correct hardware configuration [PLC Sl.No]
8. Store the program to PLC.
9. Using patch chards, connect the PLC analog output to the input of the
PWM(i.e analog output of the speed control module trainer kit).
10. Using patch chards connect the speed control module trainer kit along
input to PLC analog input.
11. Run the program
12. Check the motor speed [1500 rpm].

82
Shanmugam M
TABULATION:
S.No Setpoint SP Process Controlled Kp Ki Kd Speed
variable variable CV
PV

RESULT:
Thus the speed of the PMDC motor was controlled using Versamax Micro
PLC.

83
Shanmugam M
STUDY OF VARIOUS TYPES OF TRANSDUCERS
EXPT NO: 19 DATE:
AIM
To study the features and types of transducers

THEORY
Sensor

A sensor is a device which is capable of converting any physical quantity to be


measured into a signal which can be read, displayed, stored or used to control
some other quantity. This signal produced by the sensor is equivalent to the
quantity to be measured. Sensors are used to measure a particular characteristic
of any object or device. For example a thermocouple, a thermocouple will sense
heat energy (temperature) at one of its junction and produce equivalent output
voltage which can be measured by a voltmeter. More the temperature rise,
higher the voltage read by the voltmeter.
All sensors need to be calibrated with respect with some reference value or
standard device for accurate measurement. Below is the figure of a
thermocouple.

Note that a transducer and a sensor are not the same. In the above given example
of thermocouple. The thermocouple acts as a transducer but the additional
circuits or components needed like the voltmeter, a display etc together from a
temperature sensor. Hence the transducer will just convert the energy from one
form to another and all the remaining work is done by the additional circuits
connected. This whole device forms a sensor. Sensors and transducers are closely
related to each other.
TYPES OF SENSORS

Sensors are classified based on the nature of quantity they measure. Following
are the types of sensors with few examples.

84
Shanmugam M
Acoustic and sound sensors
e.g.: Microphone, Hydrophone.

Automotive sensors
e.g.: Speedometer, Radar gun, Speedometer, fuel ratio meter.

Chemical Sensors
e.g.: Ph sensor, Sensors to detect presences of different gases or liquids.

Electric and Magnetic Sensors


e.g.: Galvanometer, Hall sensor (measures flux density), Metal detector.

Environmental Sensors
e.g.: Rain gauge, snow gauge, moisture sensor.

Optical Sensors
e.g.: Photo diode, Photo transistor, Wave front sensor.

Mechanical Sensors
e.g.: Strain Gauge, Potential meter (measures displacement).

Thermal and Temperature sensors.


e.g.: Calorimeter, Thermocouple, Thermistor, Gardon gauge.

Proximity and Presences sensors


A proximity or presences sensor is the one which is able to detect the presences of
nearby objects without any physical contact. They usually emit electromagnetic
radiations and detect the changes in reflected signal if any.
e.g.: Doppler radar, Motion detector.

Further classification can be done based on the principle of operation and nature
of output signal (analog or digital).

85
Shanmugam M
Types of Sensors
TRANSDUCER

Instrumentation is the heart of industrial applications. Instrumentation is the


art and science of measuring and controlling different variables such as flow,
level, temperature, angle, displacement etc. A basic instrumentation system
consists of various devices. One of these various devices is a transducer. A
transducer plays a very important role in any instrumentation system.
An electrical transducer is a device which is capable of converting the physical
quantity into a proportional electrical quantity such as voltage or electric
current. Hence it converts any quantity to be measured into usable electrical
signal. This physical quantity which is to be measured can be pressure, level,
temperature, displacement etc. The output which is obtained from the
transducer is in the electrical form and is equivalent to the measured quantity.
For example, a temperature transducer will convert temperature to an
equivalent electrical potential. This output signal can be used to control the
physical quantity or display it.
Note that any device which is able convert one form of energy into another form
is called as a transducer. For example, even a speaker can be called as a

86
Shanmugam M
transducer as it converts electrical signal to pressure waves (sound).But an
electrical transducer will convert a physical quantity to an electrical one.
TYPES OF TRANSDUCER

There are of many different types of transducer, they can be classified based on
various criteria as:
Types of Transducer based on Quantity to be Measured

 Temperature transducers (e.g. a thermocouple)

 Pressure transducers (e.g. a diaphragm)

 Displacement transducers (e.g. LVDT)

 Flow transducers

Types of Transducer based on the Principle of Operation


 Photovoltaic ( e.g. a solar cell )

 Piezoelectric

 Chemical

 Mutual Induction

 Electromagnetic

 Hall effect

 Photoconductors

Types of Transducer based on Whether an External Power Source is required or


not

Active Transducer

Active transducers are those which do not require any power source for their
operation. They work on the energy conversion principle. They produce an
electrical signal proportional to the input (physical quantity). For example, a
thermocouple is an active transducer.
Passive Transducers

87
Shanmugam M
Transducers which require an external power source for their operation is called
as a passive transducer. They produce an output signal in the form of some
variation in resistance, capacitance or any other electrical parameter, which
than has to be converted to an equivalent current or voltage signal. For
example, a photocell (LDR) is a passive transducer which will vary the resistance
of the cell when light falls on it. This change in resistance is converted to
proportional signal with the help of a bridge circuit. Hence a photocell can be
used to measure the intensity of light.

Above shown is a figure of a bonded strain gauge which is a passive transducer


used to measure stress or pressure. As the stress on the strain gauge increases or
decreases the strain gauge bends or compresses causing the resistance of the
wire bonded on it to increase or decrease. The change in resistance which is
equivalent to the change in stress is measured with the help of a bridge. Hence
stress is measured.
RESULT
Thus the various types of sensors/transducers was studied.

88
Shanmugam M
ADDITIONAL EXPERIMENTS

1. DESIGN OF THREE CYLINDER SEQUENTIAL CIRCUIT

PROBLEM

Design a sequential circuit to give the following sequence. A+ C- B+ A- C+ B-.


For starting every cycle of operation a manually operated valve to be actuated.
The circuit needs to be controlled with pneumatic power.

AIM

To design a pneumatic circuit to give the above sequence with pneumatic


control.

APPARATUS REQUIRED

1. Double acting cylinder 3


2. Pilot operated 4/2 valve 3
3. Air supply & FRL unit 1
4. Manually operated 3/2 valve 1
5. Lever operated 3/2 valve 6
6. Fittings and Hoses Required quantity
CIRCUIT DESCRIPTION

Three cylinders are named as A, B & C. The corresponding limit switches are
a0 & a1, b0 & b1 and c0 & c1 for home and extended positions respectively.
The directional control valves for each cylinder are named as X, Y & Z
respectively and the cylinders are connected to them. The DC valves and
individual limit switches are given with power from the FRL unit. The output
from the limit switches are given as pilot to the DC valves, to make the
respective cylinder to move. To have control on starting of the cycle (i.e. A+)
the signal from the last actuated switch is given to the corresponding pilot
through a manually operated spring return 3/2 valve, which works as a start
switch. The output from each limit switch will create movement of cylinders as
follows
a1 C-
c0 B+
b1 A-
a0 C+
c1 B-
b0 A+ (Through manually operated valve)

WORKING OF THE CIRCUIT

Compressed air through FRL unit enters to the direction control valves and limit
switches. At the home condition the cylinders A & B are at the retracted

89
Shanmugam M
condition and the cylinder C is in the extended condition. So limit switches a0, b0
& c1 are in actuated condition and power comes to corresponding DC valves. The
output from b0 is now available at starting valve. To start the cycle the starting
valve is pressed for a while and released. If the starting valve is pressed the
output from the valve goes to actuate DC value X which causes the cylinder A
move forward. Now the limit switch a0 is released and at the end of the stroke
limit switch a1 is pressed. This causes supply of pilot pressure to the DC valve Z
and this causes the cylinder C to retract. This causes limit switch c1 released
and at the end of the stroke, c0 is pressed. Air coming out of c0 is actuating the
value Y and this causes the cylinder B to move forward. The forward motion of
the cylinder B releases the limit switch b0 and at the completion of the stroke
the switch b1 is actuated. This gives the pilot supply to valve X at the opposite
side and this lead to the retraction of the cylinder A. At the end of the stroke the
limit switch a0 is pressed and the value C is actuated to move the cylinder C
forward. This, at the end of the stroke presses the limit switch c1 and this leads
to the movement of cylinder backwards which is the last stroke of the cycle. At
the end of the cycle the limit switch b0 is pressed and the power comes to the
manually operated valve. As the manually operated valve is returned back to the
closed position by the spring after the hand pressure is released, the cycle stops
here waiting for another pressing of the start switch to start the next cycle.

RESULT

The given circuit is designed, constructed with the available components and
checked for working.

90
Shanmugam M
91
Shanmugam M
DESIGN OF AND / OR LOGIC FUNCTIONS

2. PROBLEM

A Machine clutch operated by a pneumatic cylinder will engage when


cylinder moves forward. The cylinder should move forward either if two
push buttons are pressed simultaneously or a remotely operated push
button is pressed. Design the circuit.

AIM

To construct AND / OR logic functions circuits.

COMPONENTS REQUIRED

1. Double acting 1
2. AND Valve
Cylinder 1
3. OR Valve 1
4. 4/2 DCV 1
5. Push button DCV 3
6. FRL Unit 1

DESCRIPTION

The input from the compressor is given to the FRL unit to get desired pressure
level. Then it is connected to input of directional control valve, Push buttons.
The output of two push button is connected to AND valve and output of AND
valve is given to the input of OR valve and another input is from the push
button. Output of OR valve is given to the directional control valve. The two
ends of double acting cylinder is connected to directional control valve.

WORKING

When both the push button of AND valve is pressed, then only we get the
extension and retraction of the cylinder. Where as in the case of OR valve, one
push button is pressed which is enough for the getting the extension and
retraction of the cylinder.

RESULT

Thus the logic AND and OR circuit were constructed and verified.

92
Shanmugam M
AND / OR logic functions circuit

93
Shanmugam M

Vous aimerez peut-être aussi