Professional Documents
Culture Documents
com
LAB MANUAL
(2013 Regulation)
Prepared by,
SYLLABUS
OBJECTIVES:
LIST OF EXPERIMENTS:
TOTAL: 45 PERIODS
OUTCOMES:
Ability to understand and analyse, linear and digital electronic circuits.
To understand and apply computing platform and software for engineering problems.
LIST OF EXPERIMENTS
CYCLE I
8-bit Microprocessor
1. Simple arithmetic operations:
(a) Addition (b) subtraction (c) multiplication (d) division.
2. Ascending / Descending order, Maximum / Minimum of numbers :
(a) Ascending order (b) Descending order (c) Maximum of numbers (d) Minimum of numbers.
3. Rotate instructions:
(a) Odd and Even Number (b) Positive and Negative Number
4.Code conversion.
(a) ASCII to hexadecimal number (b) hexadecimal to ASCII(c) hexadecimal to decimal
number (d) decimal to hexadecimal number and (e) hexadecimal to binary number
CYCLE II
8085 Interfacing Program
5. Interface Experiments:
(a) A/D Interfacing. (b) D/A Interfacing
6. Traffic light controller: I/O port - 8255
7. Serial Communication: 8251
8. Read a key, interface display: 8279
CYCLE III
8-bit Microcontroller
9. Demonstration of basic instructions with 8051 Micro controller execution, including:
(a)Addition (b) subtraction (c) multiplication (d) division.
10. (a) Conditional jumps, looping : Sum of elements in an array
(b) Calling subroutines : Check whether given number is Odd or Even using call option
11. Programming I/O Port :
(a) A/D Interfacing. (b) D/A Interfacing
12. 8085 Programming Practices with Simulators/ Jubin Open source Software
13. Interface with DC & AC motor
14. Mini project development with processors
ADDITIONAL EXPERIMENTS
15.Interfacing 8253 Timer With 8085
16. Stepper Motor Interfacing With 8051
8085 MICROPROCESSOR
AIM:
To write an assembly language program to add, subtract, multiply and divide the given
data stored at two consecutive locations using 8085 microprocessor.
a. 8 BIT DATAADDITION:
ALGORITHM:
FLOW CHART:
START
[C] 00H
[HL] 4500H
[A] [M]
[HL] [HL]+1
[A] [A]+[M]
Is there a NO
Carry ?
YES
[C] [C]+1
[HL] [HL]+1
[M] [A]
[HL] [HL]+1
[M] [C]
STOP
PROGRAM:
ALGORITHM:
START
FLOW CHART:
[C] 00H
[HL] 4500H
[A] [M]
[HL] [HL]+1
[A] [A]-[M]
Is there a NO
Borrow?
YES
Complement [A]
Add 01H to [A]
[C] [C]+1
[HL] [HL]+1
[M] [A]
[HL] [HL]+1
[M] [C]
STOP
PROGRAM:
ALGORITHM:
FLOW CHART:
START
[HL] 4500
B M
[HL] [HL]+1
A 00
C 00
Is there NO
any carry
YES
C C+1
B B-1
NO
IS B=0
YES
[HL] [HL]+1
[M] [A]
[HL] [HL]+1
[M] [C]
STOP
PROGRAM:
d. 8 BIT DIVISION:
ALGORITHM:
START
FLOWCHART:
B 00
[HL] 4500
A M
[HL] [HL]+1
M A-M
[B] [B] +1
IS A<0 No
Yes
A A+ M
YES
B B-1
[HL] [HL]+1
[M] [A]
[HL] [HL]+1
[M] [B]
STOP
PROGRAM:
OBSERVATION:
ADDITION:
SUBTRACTION:
MULTIPLICATION:
DIVISION:
RESULT:
Thus the addition, subtraction, multiplication and division of two numbers was
performed using the 8085 microprocessor.
AIM:
a. ASCENDING ORDER
ALGORITHM:
FLOWCHART: START
[HL] 4200H
[C] [HL]
[C] [C] -1
[D] [C]
[HL] 4201H
[A] [HL]
[HL [HL] + 1
Yes Is
[A] < [HL]?
No
[B] [HL]
[HL] [A]
[HL] [HL] - 1
[HL] [B]
[HL] [HL] + 1
[D] [D] – 01 H
IS No
[D] = 0?
Yes
[C] [C]-1
IS No
[C] = 0?
Yes
STOP
PROGRAM:
b. DESCENDING ORDER
ALGORITHM:
FLOWCHART: START
[HL] 4200H
[C] [HL]
[C] [C] -1
[D] [C]
[HL] 4201H
[A] [HL]
[HL [HL] + 1
No Is
[A] < [HL]?
Yes
[B] [HL]
[HL] [A]
[HL] [HL] - 1
[HL] [B]
[HL] [HL] + 1
[D] [D] – 01 H
IS No
[D] = 0?
Yes
[C] [C]-1
IS No
[C] = 0?
Yes
STOP
PROGRAM:
FLOW CHART:
START
[HL] [4200H]
[A] [HL]
[HL [HL] + 1
NO IS
[A] < [HL]?
YES
[A] [HL]
[B] [B]-1
NO
IS
[B] = 0?
YES
[4300] [A]
STOP
PROGRAM:
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content (next
element).
7. If the accumulator content is smaller, then move the memory content
(largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.
FLOW CHART:
START
[HL] [4200H]
[A] [HL]
[HL [HL] + 1
YES IS
[A] > [HL]?
NO
[A] [HL]
[B] [B]-1
IS NO
[B] = 0?
YES
[4300] [A]
STOP
PROGRAM:
OBSERVATION:
A. ASCENDING ORDER
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
4200(Array Size) 05
4201 4201
4202 4202
4203 4203
4204 4204
4205 4205
B. DESCENDING ORDER
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
4200(Array Size) 05
4201 4201
4202 4202
4203 4203
4204 4204
4205 4205
C. SMALLEST ELEMENT
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
4200(Array Size) 05
4201
4202 4300
4203
4204
4205
D. LARGEST ELEMENT
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
4200(Array 05
Size)
4201
4202 4300
4203
4204
4205
RESULT:
Thus the sorting operations of arranging an array in ascending, descending order and
the largest and smallest element werefound using the 8085 microprocessor.
AIM:
To find the number of even and odd number, and number of positive and negative
numbers in a block of data.
ALGORITHM:
1. Start.
2. Load the given data.
3. Clear the data in accumulator.
4. Move the content of accumulator to D and B register.
5. Increment HL register pair and move the content of memory to accumulator.
6. Rotate the obtain data in the form of RAR.
7. If carry occur increment B else increment D.
8. Decrement C, if C ≠0 go to step 5. Else increment HL pair.
9. Move the content of D to memory and increment HL pair and move the content B to
memory.
10. Stop.
START
[HL] [4200H]
[C] [HL]
[A] 00H
[B] [A]
[D] [A]
[HL [HL] + 1
[A] [HL]
Yes No
Is CY=1
[C] [C]-1
Is No
[C] = 0?
Yes
STOP
ALGORITHM:
1. Start.
2. Load the given data.
3. Clear the data in accumulator.
4. Move the content of accumulator to D and B register.
5. Increment HL register pair and move the content of memory to accumulator.
6. Rotate the obtain data in the form of RAL.
7. If carry occur increment B else increment D.
8. Decrement C, if C ≠0 go to step 5. Else increment HL pair.
9. Move the content of D to memory and increment HL pair and move the content B to
memory.
10. Stop.
START
[HL] [4200H]
[C] [HL]
[A] 00H
[B] [A]
[D] [A]
[HL [HL] + 1
[A] [HL]
Yes No
Is CY=1
[C] [C]-1
Is No
[C] = 0?
Yes
STOP
Observation
INPUT: OUTPUT:
4200 = 04 (Array Size) 4205= (Odd numbers)
4202 =
4203 =
4204 =
INPUT: OUTPUT:
4200 = 04 (Array Size) 4205= (Negative numbers)
4202 =
4203 =
4204 =
RESULT:
Thus the number of even and odd number, and positive and negative number has been
found from the given numberof list.
AIM:
a.ASCII TO HEXADECIMAL
ALGORITHM:
FLOWCHART:
Start
Subtract 30 from A
Check YES
for
Carry?
NO
Subtract 07 from A
Stop
PROGRAM:
b.HEXADECIMAL TO ASCII
ALGORITHM:
FLOWCHART:
Start
Add 30 to A
Check YES
for
Carry?
NO
Store the decimal value
Stop
PROGRAM:
c.HEXADECIMAL TO BINARY
ALGORITHM:
FLOWCHART:
Start
Initialize counter B to 08
Decrement B register
NO
If B=0?
YES
Stop
PROGRAM:
d. BCD TO HEXADECIMAL
ALGORITHM:
FLOWCHART:
Start
Clear AReg
A=A+E
Stop
PROGRAM:
4111
4112 L1 ADI 0A Add immediate data
OAHto the accumulator
4113
4114 DCR D Decrement the D
register
4115 JNZ L1 Jump if no zero to
4112H
4116
4117
4118 ADD E Add the content of E
register to Accumulator
e. HEXADECIMAL TO DECIMAL
ALGORITHM:
FLOWCHART:
Start
Initialize D register
Clear accumulator
Move HL to C register
Add 01 with A
Adjust A to BCD
YES
Check
Carry?
NO
Increment D register
Increment C register
NO
Check
Carry?
YES
Store A in 4151 H
Move D to accumulator
Store A in 4150 H
Stop
PROGRAM:
OBSERVATION:
a. ASCII TO HEXADECIMAL
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
4200(Array Size) 02 4301
4201 4302
4202
b. HEXADECIMAL TO ASCII
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
4200(Array 02 4301
Size)
4201 4302
4202
c. HEXADECIMAL TO BINARY
INPUT OUTPUT
MEMORY DATA MEMORY DATA MEMORY DATA
LOCATION LOCATION LOCATION
4201 4205
4200 4202 4206
4203 4207
4204 4208
d. BCD TO HEXADECIMAL
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
4200 4300
e. HEXADECIMAL TO DECIMAL
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
4150 4151
4152
RESULT:
Thus the assembly language programs for various code conversions are executed using
8085 microprocessor.
APPARATUS REQUIRED:
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.
PROGRAM:
ADC- CIRCUIT:
OBSERVATION
APPARATUS REQUIRED:
SOFTWARE EXAMPLES
The following examples illustrate how to control the DAC using 8085 and generate sine
wave, saw tooth wave by means of software.
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, results in a square wave of amplitude I5 Volts
ALGORITHM:
PROGRAM:
Execute the program and using a CRO, verify that the waveform at the DAC2 output is a
square-wave. Modify the frequency of the square-wave, by varying the time delay.
ALGORITHM:
PROGRAM:
ALGORITHM:
DAC - CIRCUIT:
WAEFORMS:
OBSERVATION:
Result:
Thus the conversion of an analog signal into a digital signal and a digital signal into an
analog signal was done using interfacing of ADC and DAC respectively with 8085.
AIM
To write an assembly language program to simulate the traffic light at an intersection
using a traffic light interface.
APPARATUS REQUIRED:
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.
BIT ALLOCATION:
PATH REPRESENTATION:
PROGRAM:
RESULT:
Thus an assembly language program to simulate the traffic light at an intersection using a
traffic light interfaces was written and implemented.
To write a program to initiate 8251 and to check the transmission and reception
of character.
APPARATUS REQUIRED:
1. 8085 Microprocessor kit
2. 8251 Interface board
3. DC regulated power supply
THEORY:
Prior to starting data transmission or reception, the 8251 must be loaded with a
set of control words generated by the CPU.These control signals define the complete
functional definition of the 8251 and must immediately follow a RESET operation. Control
words should be written in to the control register of 8251. Words should be written in to the
control register of 8251.words should be written in to the control register of
8251.Thesecontrol words are split into two formats.
1. MODE INSTRUCTION WORD
2. COMMAND INSTRUCTION WORD.
This format defines the BAUD rate, character length, parity and stop bits required to
work with asynchronous data communication. By selecting the appropriate BAUD
factor synchronous mode, the 8251 can be operated in synchronous mode.
8 bit data
No parity
Baud rate factor (16X)
1 stop bit
Gives a mode command word of 01001110=4E(X)
ALGORITHM
PROGRAM:
SYNCHRONOUS MODE:
S2 S1 EP PEN L2 L1 B2 B1
0 1 0 1
0 0 1 1
5 6 7 8
BIT BIT BIT BIT
PARITY ENABLE
1-Enable
0-Disable
ASYNCHRONOUS MODE:
S2 S1 EP PEN L2 L1 B2 B1
0 1 0 1
0 0 1 1
Synch (1 X) (16 X) (64 X)
mode
0 1 0 1
0 0 1 1
5 6 7 8
BIT BIT BIT BIT
PARITY ENABLE
1-Enable
0-Disable
0 1 0 1
0 0 1 1
Invalid 61BIT 1.5BIT 2 BIT
OBSERVATION:
RESULT:
Thus the program to initiate 8251 was written and the transmission and reception of
character was checked by interfacing 8251 with 8085.
AIM:
To interface 8279 Programmable Keyboard Display Controller to 8085 Microprocessor.
APPARATUS REQUIRED:
PROGRAM:
4130 FF
4131 FF
4132 FF
4133 FF
4134 FF
4135 FF
4136 FF
4137 FF
4138 98
4139 68
413ª 7C
413B C8
413C 1C
413D 29
413E FF
413F FF
SEGMENT DEFINITION:
DATA BUS D7 D6 D5 D4 D3 D2 D1 D0
SEGMETS d c b a dp g f e
OBSERVATION:
Accept a Key and display the same ( Two key lock out)
4100 MVI B, 08
4102 MVI A, 00
4104 OUT C2 Set mode and display
4106 MVI A, 0CC Clear Display
4108 OUT C2
410A MVI A, 90 Write display
410C OUT C2
410E MVI A, 0FF
4110 BACK OUT C0 Clear the display ram
4112 DCR B
4113 JNZ BACK
4116 LOP IN C2 Pressing of a key
4118 ANI 07
411A JZ LOP
411D MVI A, 40 Set to read FIFO ram
411F OUT C2
4121 IN C0
4123 ANI 0F get the corresponding code
from lookup table
4125 MOV L, A
4126 MVI H, 42
4128 MOV A,M
4129 OUT C0
412B JMP LOP
4200 0C 9F 4A 0B
4204 99 29 28 8F
4208 08 09 88 38
420C 6C 1A 68 E8
4100 MVI B, 08
4102 MVI A, 02
4104 OUT C2 Set mode and display
4106 MVI A, 0CC Clear Display
4108 OUT C2
410A MVI A, 90 Write display
410C OUT C2
410E MVI A, 0FF
4110 BACK OUT C0 Clear the display ram
4112 DCR B
4113 JNZ BACK
4116 LOP IN C2 Pressing of a key
4118 ANI 07
411A JZ LOP
411D MVI A, 40 Set to read FIFO ram
411F OUT C2
4121 IN C0
4123 ANI 0F get the corresponding code
from lookup table
4125 MOV L, A
4126 MVI H, 42
4128 MOV A,M
4129 OUT C0
412B JMP LOP
4200 0C 9F 4A 0B
4204 99 29 28 8F
4208 08 09 88 38
420C 6C 1A 68 E8
RESULT:
Thus 8279 controller was interfaced with 8085 and program for read a key and display and
rolling display were executed successfully.
MICROCONTROLLER
AIM:
To write an assembly language program to add, subtract, multiply and divide the given
data stored at two consecutive locations using 8051 microcontroller.
Algorithm:
Start
CLEAR R0 REGISTER
Yes
If
INCREMENT R0 REG
CY=1
No
INCREMENT DPTR
Stop
Observation:
Input:
4500: [Addend]
4501: [Augend]
Output:
4502: [Sum]
4503: [Carry]
Start
No INCREMENT R0 REG
INCREMENT DPTR
Stop
Algorithm:
Observation:
Input:
4500: [Minuend]
4501: [Subtrahend]
Output:
4502: [Difference]
4503: [Sign Bit]
Start
MULTIPLY A AND B
INCREMENT DPTR
INCREMENT DPTR
Stop
Algorithm:
Observation
Input:
Output:
Start
INCREMENT DPTR
INCREMENT DPTR
INCREMENT DPTR
Stop
Algorithm:
Observation:
Input:
4500: [Dividend]
4501: [Divisor]
Output:
4502: [Quotient]
4503: [Remainder]
Result:
Thus the addition, subtraction, multiplication and division of two numbers were
performed using the 8051 microcontroller.
AIM:
To find the sum of elements in an array.
ALGORITHM:
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.
START
[DPTR] [4200H],
Clear B, R1 and CY
[A] [DPTR]
[R0] [A]
[A] [DPTR+1]
No
Is Cy=1
Yes
[R1] [R1]+1
[R0] [R0]-1
No
IS
[R0] = 0?
Yes
STOP
PROGRAM:
OBSERVATION:
INPUT OUTPUT
4200(Array Size) 05 4500
4201
4202
4203 4501
4204
4205
RESULT:
The sum of elements in an array is calculated.
ALGORITHM:
1. Start
2. Move the data to DPTR
3. Move the data to accumulator
4. Call check function whether given number is odd or even
5. Increment DPTR
6. Resultant value stored in DPTR-4201
7. Halt
Check Function
8. Rotate right through carry
9. If carry copy 00 to B reg (odd number)
10. Else copy EE to B reg (even number)
11. return
START
[DPTR] [4200H]
[A] [DPTR]
[DPTR] [DPTR] +1
[A] [B]
[DPTR] [A]
STOP
Yes No
Is CY=1
Return
PROGRAM:
OBSERVATION:
INPUT OUTPUT
4200 4201
RESULT:
Thus the given number is either even or odd has been found using 8051 microcontroller.
APPARATUS REQUIRED:
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.
PROGRAM:
ADC- CIRCUIT:
OBSERVATION
APPARATUS REQUIRED:
THEORY:
SOFTWARE EXAMPLES
After going through the software examples you can learn how to control the
DAC using 8051 and generate sine wave, saw tooth wave etc by means of software.
ALGORITHM:
DAC - CIRCUIT:
WAVEFORMS:
OBSERVATION:
PROGRAM:
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,
results in a square wave of amplitude I5 Volts.
PROGRAM:
The following program will generate a triangular wave at DAC2 output. The program is
self explanatory.
OBSERVATION:
Result:
Thus the square, triangular and saw tooth wave form were generated by interfacing
DAC with 8051 trainer kit
AIM:
To interface 8253 Interface board to 8085 microprocessor to demonstrate the generation of
square wave.
APPARATUS REQUIRED:
1. 8085 microprocessor kit
2. 8253 Interface board
3. DC regulated power supply
4. CRO.
.
PROGRAM:
Set the jumper, so that the clock 0 of 8253 is given a square wave of frequency 1.5
MHz. This program divides this PCLK by 10 and thus the output at channel 0 is 150 KHz.
Vary the frequency by varying the count. Here the maximum count is FFFF H. So, the
square wave will remain high for 7FFF H counts and remain low for 7FFF H counts. Thus
with the input clock frequency of 1.5 MHz, which corresponds to a period of 0.067
microseconds, the resulting square wave has an ON time of 0.02184 microseconds and an OFF
time of 0.02184 microseconds.
To increase the time period of square wave, set the jumpers such that CLK2 of 8253 is
connected to OUT 0. Using the above-mentioned program, output a square wave of frequency
150 KHz at channel 0. Now this is the clock to channel 2.
CONTROL WORD:
SC-SELECT COUNTER:
M-MODE:
M2 M1 M0 MODE
0 0 0 Mode 0
0 0 1 Mode 1
X 1 0 Mode 2
X 1 1 Mode 3
1 0 0 Mode 4
1 0 1 Mode 5
READ/WRITE:
RW1 RW0
0 0 Counter latch command
0 1 R/W least significant bit only
1 0 R/W most significant bit only
BCD:
Result:
Thus the 8253 has been interfaced to 8085 p and with different modes of 8253 have
been studied.
AIM:
To interface a stepper motor with 8051 microcontroller and operate it.
THEORY:
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 step-wise manner from one equilibrium position
to the next. Stepper Motors are used very wisely in position control systems like printers, disk
drives, process control machine tools, etc.
The basic two-phase stepper motor consists of two pairs of stator poles. Each of the
four poles has its own winding. The excitation of any one winding generates a North Pole. A
South Pole gets induced at the diametrically opposite side. The rotor magnetic system has two
end faces. It is a permanent magnet with one face as South Pole and the other as North Pole.
The Stepper Motor windings A1, A2, B1, B2 are cyclically excited with a DC current
to run the motor in clockwise direction. By reversing the phase sequence as A1, B2, A2, B1,
anticlockwise stepping can be obtained.
ANTICLOCKWISE CLOCKWISE
STEP A1 A2 B1 B2 DATA STEP A1 A2 B1 B2 DATA
1 1 0 0 1 9h 1 1 0 1 0 Ah
2 0 1 0 1 5h 2 0 1 1 0 6h
3 0 1 1 0 6h 3 0 1 0 1 5h
4 1 0 1 0 Ah 4 1 0 0 1 9h
BLOCK DIAGRAM:
8051
MICROCONTROLLER 8255
DRIVER CIRCUIT STEPPER MOTOR
REPRESENTATION:
PROGRAM :
MNEM
Label OPERAND Comments
ONICS
ORG 4100h
PROCEDURE:
1. Enter the above program starting from location 4100.and execute the same.
2. The stepper motor rotates.
3. Varying the count at R4 and R5 can vary the speed.
4. Entering the data in the look-up TABLE in the reverse order can vary direction of
rotation.
RESULT:
Thus a stepper motor was interfaced with 8051 and run in forward and reverse
directions at various speeds.
Ex No. 12 8085 Programming Practices with Simulators/ Jubin Open source Software
Aim
To write an assembly language program to multiply the given data stored at two consecutive
locations using 8085 microprocessor simulator.
Motivation
Understanding of Intel 8085 microprocessor is fundamental to getting insight into the Von-
Neumann Architecture. It was first introduced in 1976, since then many generations of
computer architecture have come up, some still persists while others are lost in history. This
microprocessor still survives because it is still popular in university and training institutes to
get students acquainted with basic computer architecture. For this purpose 8085 trainer kit
are available on the market.
With this academic learning purpose in mind 8085 simulator software is designed. It helps
in get started easily with example codes, and to learn the architecture playfully. It also
provides a trainer kit as an appealing functional alternative to real hardware. The users can
write assembly code easily and get results quickly without even having the actual hardware.
Jubin 8085 simualor is open source software which is available at
https://8085simulator.codeplex.com/downloads/get/86234
Features
1. Assembler Editor
• Can load Programs written in other simulator
• Auto-correct and auto-indent features
• Supports assembler directives
• Number parameters can be given in binary, decimal and hexadecimal format
• Supports writing of comments
• Supports labeling of instructions, even in macros
• Has error checking facility
• Syntax Highlighting
2. Disassembler Editor
• Supports loading of Intel specific hex file format
• It can successfully reverse trace the original program from the assembly code, in
most of the cases
• Syntax Highlighting and Auto Spacing
3. Assembler Workspace
• Contains the Address field, Label, Mnemonics, Hex-code, Mnemonic Size, M-
Cycles and T-states
• Static Timing diagram of all instruction sets are supported
• Dynamic Timing diagram during step by step simulation
• It has error checking facility also
4. Memory Editor
• Can directly update data in a specified memory location
• It has 3 types of interface, user can choose from it according to his need.
– Show entire memory
content
– Show only loaded memory location
– Store directly to specified memory location
• Allows user to choose memory range
5. I/O Editor
• It is necessary for peripheral interfacing.
• Enables direct editing of content
6. Interrupt Editor
• All possible interrupts are supported. Interrupts are triggered by pressing the
appropriate column (INTR, TRAP, RST 7.5, RST 6.5, RST 5.5) on the interrupt
table. The simulation can be reset any time by pressing the clear memory in the
settings tab.
7. Debugger
• Support of breakpoints
• Step by step execution/debugging of program.
• It supports both forward and backward traversal of programs.
• Allows continuation of program from the breakpoint.
8. Simulator
• There are 3 level of speed for simulation:
– Step-by-step −→ Automatic line by line execution with each line
highlighting. The time to halt at each line is be decided by the user.
– Normal −→ Full execution with reflecting intermittent states periodically.
Directives
Assembler
Directives Example
Description
ORG (Origin)
# ORG C000H The next block of instruction should be stored
in memory locations starting at C000H
Debugging Mode
The debug mode allows the user to view and/or manipulate the program’s internal state for the
purpose of debugging. The software allows step wise or block wise line monitor with both
forward and backward traversal facility.
PROGRAM
#ORG 2000
#BEGIN 2000
LXI H, 4200
MOV B,M
INX H
MVI C,00
MVI A,00
L2: ADD M
JNC L1
INR C
L1: DCR B
JNZ L2
INX H
MOV M,A
INX H
MOV M,C
HLT
#ORG 4200
#DB 23,42
Click
ASSEMBLE, Run all at a Time and then Memory
Observation
Input Output
4200 4202
4201 4203
Result
Thus the multiplication of two numbers was performed using the 8085 microprocessor
simulator.