MPMC RECORD FINAL PRINT Eee
MPMC RECORD FINAL PRINT Eee
MPMC RECORD FINAL PRINT Eee
& MICROCONTROLLERS
RECORD
Dr.NGP.IT/EEE/LM/V 3.3
Dr. NGPIT2017. All rights reserved.
This document is meant for exclusive use of Dr.NGPIT. No part of the document may be copied, reproduced, stored in any retrieval
system, or transmitted in any form or by any means, electronically, mechanically, or otherwise without prior written permission.
Dr.N.G.P. INSTITUTE OF TECHNOLOGY
Dr.N.G.P.-Kalapatti Road, Coimbatore – 641048. Tamil Nadu.Ph:0422 – 2369105
BONAFIDE CERTIFICATE
Department of
Electrical and Electronics Engineering certified that this is a bonafide record of work
done by Mr. / Ms. …………………………………………………… of the ……………………………
B.E. / B.Tech. / M.E. / M.Tech. in the EE6612 – Microprocessors & Microcontrollers
Laboratory conducted in this institution, as prescribed by Anna University – Chennai, for
the ............. semester, during the academic year 2018 / 2019.
Date:
…………………………………………………………………………………
CONTENTS
Ex. Page. Faculty
Date Name of the Experiment Marks
No. No. Signature
Average
Faculty In - Charge
Ex. No : 1
8 BIT ARITHMATIC OPERATIONS
DATE :
AIM
To write an assembly language program for Intel 8085 microprocessor to
perform the following functions;
(a) 8-bit addition
(b) 8-bit subtraction
(c) 8-bit multiplication and
(d) 8-bit division.
To check the above programs by executing using 8085 trainer kit.
APPARATUS REQUIRED
b. 8 BIT SUBTRACTION
1. Start the program.
2. Load the first data in the accumulator.
3. Move the content of A to B register.
4. Load the second data in the accumulator.
5. Initialize the Borrow with zero.
6. Add the content of B register to the accumulator.
7. If the borrow is “0” then store the result in address 4252.
8. If the borrow is “1” then increment the C register by one and store the result.
9. Stop the program.
c. 8 BIT MULTIPLICATION
1. Start the program.
2. Get the multiplier and multiplicand.
3. Initialize the carry register
4. Initialize count register with the multiplier
5. Clear the accumulator.
6. Add accumulator with multiplicand
7. If carry occurs, increment the carry register.
8. Decrement the count register.
9. If count is zero go to step 1.
10. Else go to step 6.
11. Store the contents of the accumulator in the location specified.
12. Store carry register in the location specified.
13: Stop the program.
d. 8 BIT DIVISION
1. Start the program.
2. Get the divisor and dividend.
3. Initialize count register with divisor
4. Clear accumulator.
5. Move the dividend into accumulator
6. Subtract divisor from accumulator.
7. Increment the count register.
8. Compare accumulator with divisor.
9. If division is less go to step 5 else to next step.
10. Stop the program.
OBSERVATIONS
Addend : Sum:
8-Bit Addition
Augend : Carry:
Subtrahend : Difference :
8-Bit Subtraction
Minuend: Borrow:
Multiplicand : Product :
8-Bit Multiplication
Multiplier : Overflow:
Dividend: Quotient:
8-Bit Division
Divisor: Remainder:
INFERENCE
RESULT
Ex. No : 2
16 BIT ARITHMATIC OPERATIONS USING 8085
DATE :
AIM
To write assembly language programs for Intel 8085 microprocessor to perform
the following functions;
(a) 16-bit addition
(b) 16-bit subtraction
(c) 16-bit multiplication and
(d) 16-bit division.
To check the above programs by executing 8085 trainer.
APPARATUS REQUIRED
1. 8085 Trainer
2. Operation Code sheet
ALGORITHM
a. 16 BIT DATA ADDITION
OBSERVATIONS
Program Address & Data Result
Addend : Sum:
16-Bit Addition
Augend : Carry:
Subtrahend : Difference :
16-Bit Subtraction
Minuend: Borrow:
Multiplicand : Product :
16-Bit Multiplication
Multiplier : Overflow:
Dividend: Quotient:
16-Bit Division
Divisor: Remainder:
INFERENCE
RESULT
Ex. No : 3
8085 PROGRAMMING WITH CONTROL INSTRUCTIONS
DATE :
AIM
To write assembly language programs for Intel 8085 microprocessor to perform
the following functions
(a) Arrange an array of numbers in ascending and descending order
(b) Find maximum and minimum values from an array of numbers
(c) Conversion of ASCII to HEX code and vice versa
(d) Conversion of HEX to BCD code and vice versa.
To check the above programs by executing using 8085 trainer.
APPARATUS REQUIRED
1.8085 Trainer
2. Operation Code sheet
ALGORITHM
a (i) ASCENDING ORDER
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
interchange the number.
3. If the first number is smaller, go to step 4
4. Repeat steps 2 and 3 until the numbers are arranged in the required order
OBSERVATIONS
Ascending / Descending
Order
INFERENCE
RESULT
Ex. No : 4
INTERFACING EXPERIMENT - I
DATE :
AIM
To write an assembly language program to interface the following peripherals
with 8085 microprocessor
(a) Analog to Digital Converter (IC 0808)
(b) Digital to Analog Converter (IC 0800)
(c) Programmable Peripheral Interface (IC 8255)
APPARATUS REQUIRED
1. 8085 Trainer
2. Operation Code sheet
3. Analog to Digital Converter (IC 0808) interface board
4. Digital to Analog Converter (IC 0800) interface board
5. Programmable Peripheral Interface (IC 8255) interface board
6. Multimeter (Digital)
7. Cathode Ray Oscilloscope
A. ADC INTERFACING WITH 8085
PROBLEM STATEMENT
To program starts from memory location 4100H. The program is executed for
various values of analog voltage which are set with the help of a potentiometer. The LED
display is verified with the digital value that is stored in the memory location 4150H.
THEORY
An ADC usually has two additional control lines: the SOC input to tell the ADC
when to start the conversion and the EOC output to announce when the conversion is
complete. The following program initiates the conversion process, checks the EOC pin of
ADC 0419 as to whether the conversion is over and then inputs the data to the processor.
It also instructs the processor to store the converted digital data at RAM 4200H.
ALGORITHM
1. Select the channel and latch the address.
2. Send the start conversion pulse
3. Read EOC signal.
4. If EOC =1 continue else go to step (3)
5. Read the digital output
6. Store it in a memory location.
The basic idea behind the generation of waveforms is the continuous generation
of Analog output of DAC. With 00(HEX) as input to DAC2, the analog output is -5V.
Similarly, with FF (Hex) as input, the output is +5V. Outputting digital data 00 and FF at
regular intervals, to DAC2.
ALGORITHM
1. Load the initial value (00) to Accumulator and move it to DAC.
2. Call the delay program
3. Load the final value (FF) to accumulator and move it to DAC.
4. Call the delay program.
5. Repeat steps 2 to 5.
Execute the program and verify the waveform using CRO at the DAC2 output is a square-
wave. Modify the frequency of the square-wave, by varying the time delay.
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. (a) Vehicles from west can go straight and left.
(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.
7. All ambers ar. All ambers are ON, indicating the change of sequence.
8. (a) All vehicles from all directions no movement.
(b) All pedestrian can cross the road.
OBSERVATIONS
INFERENCE
RESULT
Ex. No : 5
INTERFACING EXPERIMENTS - II
DATE :
AIM
To interface the following peripherals with 8085 microprocessor and perform
simple operations;
(a) Programmable Interval Timer (IC 8253)
(b) Universal Synchronous Asynchronous Receiver Transmitter (IC 8251)
(c) Programmable Keyboard and Display Controller (IC 8279)
APPARATUS REQUIRED
1. 8085 Trainer
2. Operation Code sheet
3. Programmable Interval Timer (IC 8253) interface board
4. Universal Synchronous Asynchronous Receiver Transmitter (IC 8251) interface
board
5. Programmable Keyboard and Display Controller (IC 8279) interface board
ALGORITHM
(A) INTERFACING OF PROGRAMMABLE INTERVAL TIMER (IC 8253)
1. Set the channel 0 in mode-3.
2. Divide the clock present at channel 1 by 10.
3. Connect the CLK 1 to PCLK.
4. Set the value of LSB and MSB count.
ALGORITHM
1. Initialize timer (8253) IC
2. Move the Mode command word (4EH) to A reg.
3. Output it port address C2
4. Move the command instruction word (37H) to A reg.
5. Output it to port address C2
6. Move the data to be transferred to A reg.
7. Output it to port address C0.
8. Reset the system
9. Get the data through input port address C0.
10. Store the value in memory
11. Reset the system
(C) INTERFACING OF PROGRAMMABLE KEYBOARD & DISPLAY CONTROLLER
(IC 8279)
1. The Common Cathode Display (CCD) – In the common cathode display, all the
cathode connections of the LED's are joined together to logic "0" or ground. The
individual segments are illuminated by application of a "HIGH", logic "1" signal to
the individual Anode terminals.
2. The Common Anode Display (CAD) – In the common anode display, all the
anode connections of the LED's are joined together to logic "1" and the individual
segments are illuminated by connecting the individual Cathode terminals to a
"LOW", logic "0" signal.
ALGORITHM
OBSERVATIONS
Output Waveform
Program
Time period Amplitude
INFERENCE
RESULT
Ex. No : 6
8 BIT ARITHMATIC OPERATIONS USING 8051
DATE :
AIM
To write assembly language programs for Intel 8051 Micro Controller to perform
the following functions;
(a) 8-bit addition
(b) 8-bit subtraction
(c) 8-bit multiplication and
(d) 8-bit division.
To check the above programs by executing 8051 trainer.
APPARATUS REQUIRED
1. 8051 Trainer
2. Operation Code sheet
ALGORITHM
a. ADDITION
1. Clear C–register for Carry
2. Get the data immediately.
3. Add the two data
4. Store the result in memory pointed by DPTR
b. SUBTRACTION
1. Clear C–register for Carry
2. Get the data immediately.
3. Subtract the two data
4. Store the result in memory pointed by DPTR
c. MULTIPLICATION
1. Get the data in A–reg.
2. Get the value to be multiplied in B–reg.
3. Multiply the two data
4. The higher order of the result is in B–reg.
5. The lower order of the result is in A–reg.
6. Store the results.
d. DIVISION
1. Get the data in A–reg.
2. Get the value to be divided in B–reg.
3. Divide the two data
4. The quotient is in A–reg.
5. The remainder is in B–reg.
6. Store the results.
OBSERVATIONS
Addend : Sum:
8-Bit Addition
Augend : Carry:
Subtrahend : Difference :
8-Bit Subtraction
Minuend: Borrow:
Multiplicand : Product :
8-Bit Multiplication
Multiplier : Overflow:
Dividend: Quotient:
8-Bit Division
Divisor: Remainder:
INFERENCE
RESULT
Ex. No : 7
MICROCONTROLLER PROGRAMMING PRACTICE
DATE :
AIM
To write assembly language programs for 8051 microcontroller to perform the
following functions;
(a) Finding sum of ‘n’ elements in an array and
(b) Block transfer of data.
To check the above programs by executing using 8085 trainer.
APPARATUS REQUIRED
1.8051 Trainer
2. Operation Code sheet
ALGORITHM
A. SUM OF ELEMENTS IN AN ARRAY
1. Load the array in the consecutive memory location and initialize the memory
pointer with the starting address.
2. Load the total number of elements in a separate register as a counter.
3. Clear the accumulator.
4. Load the other register with the value of the memory pointer.
5. Add the register with the accumulator.
6. Check for carry, if exist, increment the carry register by 1. Otherwise, continue
7. Decrement the counter and if it reaches 0, stop. Otherwise increment the memory
pointer by 1 and go to step 4.
OBSERVATIONS
Block Transfer
INFERENCE
RESULT
AIM
To write assembly language programs for 8051 microcontroller to perform the
following functions by interfacing a stepper motor and Digital to Analog Converter -
IC0800;
a. To run the stepper motor at different speed
b. To run the stepper motor for required angle
c. To generate a square waveform at DAC2 output
d. To generate a triangular waveform at DAC2 output
APPARATUS REQUIRED
1.8051 Trainer
2. Operation Code sheet
A. STEPPER MOTOR CONTROL
THEORY
A stepper motor is a brushless, synchronous electric motor that converts digital
pulses into mechanical shaft rotation. Every revolution of the stepper motor is divided
into a discrete number of steps, and the motor must be sent a separate pulse for each
step.
Stepping motors have low-power density and lower maximum speed compared to
brushed and brushless DC motors. Typical loaded maximum operating speeds for
stepper motors are around 1000 RPM.
Motors with permanent magnets are subjected to influence from the back-EMF of
the rotor, which limits the maximum speed. Therefore, when high speeds are required, motors
with variable reluctance are preferred over motors with permanent magnets.
Hybrid stepping motors combine a permanent magnet and a rotor with metal
teeth to provide features of the variable reluctance and permanent magnet motors.
Hybrid motors are more expensive than motors with permanent magnets, but they use
smaller steps, have greater torque, and have greater maximum speeds.
A hybrid motor rotor has teeth placed on the directional axes. The rotor is divided into
parts between constant magnet poles. The number of rotor pole pairs is equal to the
number of teeth on one of the rotor’s parts. The hybrid motor stator has teeth creating
more poles than just the main poles containing windings. The rotor teeth provide a
smaller magnetic circuit resistance in some rotor positions, which improves static and
dynamic torque. This is provided by corresponding teeth positioning; some parts of the
rotor teeth are placed opposite the stator teeth and the remaining rotor teeth are placed
between the stator teeth. Dependence between the number of rotor poles, the stator
equivalent poles, and the phase number define step angle:
Rotation of a hybrid stepping motor is produced with the same control method
as a permanent magnet stepping motor, by energizing individual windings in a positive
or negative direction. When a winding is energized, a north and south pole are created,
depending on the polarity of the current flowing. These generated poles attract the
permanent poles of the rotor and the finer metal rotor teeth. The rotor moves one step to
align the offset magnetized rotor teeth to the corresponding energized windings
ROTATION CONTROL
Stepping motors can be controlled in a variety of ways, trading off implementation
requirements with greater accuracy and smoother transitions. Rotation control with full-
steps, half-steps, and micro steps is described as follows:
FULL-STEP MODE
Full-step mode for a permanent magnet and hybrid stepping motor is detailed in
the Stepper Motor Introduction. In this mode, the rotor’s balanced position for each step
is in line with the stator poles. With only half of the motor coils used at a given time, the
full torque obtained is limited.
DOUBLE-STEP MODE
Two-phase, full-step mode uses both windings energized in each step. This
doubles the current through the motor and provides 40 percent more torque than when
only one phase is used at a time. With two windings energized, the rotor’s balanced
position for each step is halfway between the two energized stator poles.
HALF-STEP MODE
The full-step and double-step drive modes can be combined to generate half-steps
of rotation for half-step mode. First one winding is turned on, and then the second
winding is energized, moving the rotor half a step towards the second.
A half-step with the combination of one and two windings energized in full-step mode
produces higher resolution, but does not provide constant torque throughout rotation.
MICROSTEP MODE
Micro stepping mode is an extension of the half-step drive mode. Instead of
switching the current in a winding from on to off, the current is scaled up and down in
smaller steps. When two phases are turned on and the current of each phase is not equal,
the rotor position is determined by the current phase ratio. This changing current ratio
creates discrete steps in the torque exerted on the rotor and results in smaller fractional
steps of rotation between each full-step. Microstep mode reduces torque ripple and low-
speed resonance present in the other modes and is required in many situations.
ALGORITHM
ALGORITHM
A. SQUARE WAVE
1. Load the data 00H to accumulator and out it to the DAC address.
2. Call the Delay subroutine
3. Load the data FFH to accumulator and out it to the DAC address.
4. Call the Delay subroutine
5. Repeat the steps
B). TRIANGULAR WAVE FORM
1. Load the value 00H to accumulator and out it to the DAC address.
2. Increment it by one
3. Check whether the value equals FFH.
4. Once FFH is reached, move to step 5 else repeat steps 2 & 3.
5. Decrement the value by one.
6. When the value equals 00H, repeat the steps.
INFERENCE
RESULT
AIM
To write a program to generated gating pulse to trigger three phase inverter
using 8051 micro controller using KEIL IDE
APPARATUS REQUIRED
1 Intel Computer - P4 1
2 Keil 4 - - 1
THEORY
The C source code is very high level language, meaning that it is far from being at
the base level of the machine language that can be executed by a processor. This machine
language is basically just zero's and one's and is written in Hexadecimal format, that why
they are called HEX files.
There are several types of HEX files; we are going to produce machine code in the
INTEL HEX-80 format, since this is the output of the KEIL IDE that we are going to use.
There are several steps to convert a C program to machine language, it takes several
steps depending on the tool you are using, and however the main idea is to produce a
HEX file at the end. This HEX file will be then used by the 'burner' to write every byte of
data at the appropriate place in the EEPROM of the 89S52.
PROCEDURE
To create a project, write and test the previous example source code, follow the following
steps:
Open Keil and start a new project:
Open Keil and start a new project.
You will prompted to choose a name for your new project, Create a separate
folder where all the files of your project will be stored, chose a name and click
save. The following window will appear, where you will be asked to select a
device for Target 'Target 1'.
From the list at the left, seek for the brand name ATMEL, then under ATMEL,
select AT89S52. You will notice that a brief description of the device appears on
the right. Leave the two upper check boxes unchecked and click OK. The AT89S52
will be called your 'Target device', which is the final destination of your source
code. You will be asked whether to 'copy standard 8051 start-up code' click No.
Click File, New, and something similar to the following window should appear.
The box named 'Text1' is where your code should be written later.
Now you have to click 'File, Save as' and chose a file name for your source code
ending with the letter '.c'. You can name is 'code.c' for example, and click save.
Then you have to add this file to your project work space at the left as shown in
the following screen shot: After right-clicking on 'source group 1', click on 'Add
files to group...', then you will be prompted to browse the file to add to 'source
group 1', chose the file that you just saved, eventually 'code.c' and add it to the
source group. You will notice that the file is added to the project tree at the left.
In some versions of this software you have to turn ON manually the option to
generate HEX files. make sure it is turned ON, by right-clicking on target 1,
Options for target 'target 1', then under the 'output' tab, by checking the box
'generate HEX file'. This step is very important as the HEX file is the compiled
output of your project that is going to be transferred to the microcontroller.
You can then start to write the source code in the window titled 'code.c' then
before testing your source code, you have to compile your source code, and
Correct eventual syntax errors. In KEIL IDE, this step is called 'rebuild all targets'
and has this icon:
You can use the output window to track eventual syntax errors, but also to check
the FLASH memory occupied by the program (code = 49) as well as the registers
occupied in the RAM (data = 9). If after rebuilding the targets, the 'output
window' shows that there is 0 errors, then you are ready to test the performance
of your code. In keil, like in most development environment, this step is called
Debugging, and has this icon: After clicking on the debug icon, you will notice that
some part of the user interface will change; some new icons will appear, like the
run icon circled.
You can click on the 'Run' icon and the execution of the program will start. In our
example, you can see the behaviour of the pin 0 or port one, but clicking on
'peripherals, I/O ports, Port 1'. You can always stop the execution of the program
by clicking on the stop button and you can simulate a reset by clicking on the
'reset' button.
You can also control the execution of the program using the following
icons: which allows you to follow the execution step by step. Then,
when you're finished with the debugging, you can always return to the
programming interface by clicking again on the debug button.
WAVEFORMS
INFERENCE
RESULT
AIM
To Design and simulate flashing LED with PIC Microcontroller using Proteus
Software.
APPARATUS REQUIRED
1 Intel Computer - P4 1
THEORY
PROTEUS TUTORIAL
1. Click Start -> All Programs -> Proteus 8 Professional -> Proteus 8
Professional
The following window appears:
8. Click File -> Save. Enter the project name and click Save.
9. Click the Run icon at the bottom of the window to run the simulation
INFERENCE
RESULT