Microprocessor Lab Manual - Final
Microprocessor Lab Manual - Final
1.1 INTRODUCTION
This section briefs the hardware and software facilities available in both the trainers
Micro-85 EBl and Micro-85 EB2. Micro-85 EBl is a powerful Microprocessor Trainer
with basic features such as 24 TTL lines using 8255, Hardware Single Stepping and
Software Single Stepping of user programs.
In addition to the above features, Micro-85 EB2 has RS232C compatible serial port,
Bus Expansion for interfacing VBMB series of add-on cards and 24 TTL I/O lines. A
separate switch is provided for learning more about hardware. interrupts. There is
also provision to add multi output power supply for interfacing experiment boards.
Most of the control signals are terminated .at test points for easy analysis on CRO or
logic probe.
The differences in the specification of Micro-85 EBl and Micro-85 EB2 are highlighted
in this manual. The users are therefore requested to go through the Hardware
specification carefully.
1.2 SPECIFICATIONS
2) MEMORY:
Monitor EPROM : 0000 - 1FFF
EPROM- Expansion : 2000 - 3FFF & COOO - FFFF
System RAM : 4000 - 5FFF
Monitor Data Area : 4000 - 40FF (Reserved)
User RAM Area : 4100 - 5FFF
RAM- Expansion : 6000 - BFFF
Note: The RAM area from 4000 - 40FF should not be accessed by the
user since it is used as scratch pad by the Monitor program.
3) INPUT/OUTPUT:
Parallel: 48 TTL :I/O lines using two number of 8255
(only 24 :I/O line. available in micro-85 EB1).
Serial : One number of RS232C compatible Serial interface
using 8251A - USART.
Timer : Three channel 16-bit Programmable Timer using 8253.
- Channel 0 is used as baud rate clock generator for 8251A USART.
- Channel 1 is used for in single stepping user programs.
- Channel 2 is used for Hardware Single Stepping user programs.
4) DISPLAY:
- 6 digit, 0.3", 7 Segment Red LED Display with filter.
- 4 digits for address display and 2 digits for data display.
5) KEYBOARD :
- 21 Keys soft keyboard including command keys and hexa-decimal keys.
7) BATTERY BACKUP:
- Onboard Battery backup facility is provided for the available RAM.
This RES key allows you to terminate any present activity and to return
your Micro-85 EB to an initialized state. When pressed, the µ..85 sign-
RES on message appears in the display for a few seconds and the monitor
will display command prompt “-“ in the left most digit.
The 16 Hexa decimal keys have either a dual or a triple role to play.
i) It functions as a Hex key entry when a address or data entry is required.
ii) It functions as the Register key entry during Register command.
iii) It functions as command key when pressed directly after command prompt.
0 ii. This key is for substituting memory contents When NEXT key is
E pressed immediate1y after this it takes the user to the start
SUB address for entering user programs, 4100 Hex (User RAM).
iii. Register key "E"
FEATURES:
1. 16-bit Data bus
2. Computes 16 bit / 32 bit data.
3. 20-bit address bus.
4. More memory addressing capability (220 = 1MB)
5. 16 bit Flag register with 9 Flags
6. Can be operated in Minimum mode and Maximum mode
7. Has two stage pipelined architecture
8. No internal clock generation
9. 40 pin DIP IC - HMOS technology
10. Operates on +5V supply voltage
11. Has more powerful instruction set
Memory:
Program, data and stack memories occupy the same memory space. The total
addressable memory size is 1MB KB. As the most of the processor instructions use
16-bit pointers the processor can effectively address only 64 KB of memory. To
access memory outside of 64 KB the CPU uses special segment registers to specify
where the code, stack and data 64 KB segments are positioned within 1 MB of
memory (see the "Registers" section below).
Program memory - program can be located anywhere in memory. Jump and call
instructions can be used for short jumps within currently selected 64 KB code
segment, as well as for far jumps anywhere within 1 MB of memory. All conditional
jump instructions can be used to jump within approximately +127 - -127 bytes
from current instruction.
Data memory - the processor can access data in any one out of 4 available
segments, which limits the size of accessible memory to 256 KB (if all four
segments point to different 64 KB blocks). Accessing data from the Data, Code,
Stack or Extra segments can be usually done by prefixing instructions with the DS:,
CS:, SS: or ES: (some registers and instructions by default may use the ES or SS
segments instead of DS segment).
Word data can be located at odd or even byte boundaries. The processor uses two
memory accesses to read 16-bit word located at odd byte boundaries. Reading
word data from even byte boundaries requires only one memory access.
Stack memory can be placed anywhere in memory. The stack can be located at
odd memory addresses, but it is not recommended for performance reasons (see
"Data Memory" above).
Reserved locations:
• 0000h - 03FFh are reserved for interrupt vectors. Each interrupt vector is a
32-bit pointer in format SEGMENT:OFFSET.
• FFFF0h - FFFFFh - after RESET the processor always starts program execution
at the FFFF0h address.
Interrupts:
I/O ports:
8086 can interface maximum of 65536 nos of 8-bit I/O ports. These ports can be
also addressed as 32768 16-bit I/O ports.
Registers:
Stack segment (SS) is a 16-bit register containing address of 64KB segment with
program stack. By default, the processor assumes that all data referenced by the
stack pointer (SP) and base pointer (BP) registers is located in the stack segment.
SS register can be changed directly using POP instruction.
Data segment (DS) is a 16-bit register containing address of 64KB segment with
program data. By default, the processor assumes that all data referenced by
general registers (AX, BX, CX, DX) and index register (SI, DI) is located in the data
segment. DS register can be changed directly using POP and LDS instructions.
All general registers of the 8086 microprocessor can be used for arithmetic and
logic operations. The general registers are:
Accumulator (AX) register consists of 2 8-bit registers AL and AH, which can be
combined together and used as a 16-bit register AX. AL in this case contains the
low-order byte of the word, and AH contains the high-order byte. Accumulator can
be used for I/O operations and string manipulation.
Base (BX) register consists of 2 8-bit registers BL and BH, which can be combined
together and used as a 16-bit register BX. BL in this case contains the low-order
byte of the word, and BH contains the high-order byte. BX register usually contains
a data pointer used for based, based indexed or register indirect addressing.
Count (CX) register consists of 2 8-bit registers CL and CH, which can be
combined together and used as a 16-bit register CX. When combined, CL register
contains the low-order byte of the word, and CH contains the high-order byte.
Count register can be used as a counter in string manipulation and shift/rotate
instructions.
Data (DX) register consists of 2 8-bit registers DL and DH, which can be combined
together and used as a 16-bit register DX. When combined, DL register contains the
low-order byte of the word, and DH contains the high-order byte. Data register can
be used as a port number in I/O operations. In integer 32-bit multiply and divide
instruction the DX register contains high-order word of the initial or resulting
number.
Source Index (SI) is a 16-bit register. SI is used for indexed, based indexed and
register indirect addressing, as well as a source data address in string manipulation
instructions.
Destination Index (DI) is a 16-bit register. DI is used for indexed, based indexed
and register indirect addressing, as well as a destination data address in string
manipulation instructions.
Other registers:
• Overflow Flag (OF) - set if the result is too large positive number, or is too
small negative number to fit into destination operand.
• Direction Flag (DF) - if set then string manipulation instructions will auto-
decrement index registers. If cleared then the index registers will be auto-
incremented.
• Interrupt-enable Flag (IF) - setting this bit enables maskable interrupts.
• Single-step Flag (TF) - if set then single-step interrupt will occur after the next
instruction.
• Sign Flag (SF) - set if the most significant bit of the result is set.
• Zero Flag (ZF) - set if the result is zero.
• Auxiliary carry Flag (AF) - set if there was a carry from or borrow to bits 0-3
in the AL register.
• Parity Flag (PF) - set if parity (the number of "1" bits) in the low-order byte of
the result is even.
• Carry Flag (CF) - set if there was a carry from or borrow to the most
significant bit during last result calculation.
Instruction Set:
Addressing modes:
Implied - the data value/data address is implicitly associated with the instruction.
Direct - the instruction operand specifies the memory address where data is
located.
Based Indexed - the contents of a base register (BX or BP) is added to the
contents of an index register (SI or DI), the resulting value is a pointer to location
where data resides.
Result:
The features of the Intel 8085 & 8086 microprocessors were studied and operations
of the corresponding kits were understood.
AIM: To write an assembly language program for the addition of two 8-bit numbers.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 Power supply unit 1
THEORY:
The two operands (i.e., 8-bit numbers) are loaded into two registers A & B, using
immediate addressing mode instructions and then added using ADD instruction. The
result is stored in the desired memory location. The overflow in addition is checked
by verifying the status of Carry (Cy) flag and accordingly either “00” or “01” is stored
in the location next to the result.
ALGORITHM:
1. Start the program
2. Initialize the C register as 00H.
3. Move the data1 and data2 to Accumulator and B register respectively.
4. Add B register to the content of accumulator
5. If there is no carry, go to step 6, else increment C register.
6. Store the content of accumulator to the memory location 4500H.
7. Move the content of C register to accumulator.
8. Store the content of accumulator to the memory location 4501H.
9. Stop the program.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4100 0E, 00 MVI C, 00 Clear c register
Move data1 to
4102 3E, Data1 MVI A, Data1
accumulator
4104 06, Data2 MVI B, Data2 Move data2 to B Register
4106 80 ADD B Add B Reg to accumulator
Jump on No carry to
4107 D2, 0B,41 JNC GO
location GO
410A 0C INR C Increment C Register
MANUAL CALCULATION:
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
4500
4103 05H 0BH
(Result)
4501
4105 06H 00H
(Carry)
INPUT OUTPUT
Address Data Address Data
4500
4103 51H 3CH
(Result)
4501
4105 EBH 01H
(Carry)
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
4500
4103
(Result)
4501
4105
(Carry)
RESULT:
Thus the assembly language program for 8-bit addition is executed and the results
are verified.
AIM: To write an assembly language program for the subtraction of two 8-bit
numbers, using 8085.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 Power supply unit 1
THEORY:
Out of the two operands for subtraction, the first operand is loaded into Accumulator
and the second operand is subtracted directly from memory, using register indirect
addressing mode instructions. The result is stored in desired memory location and
the borrow in subtraction is checked by verifying the status of Carry (Cy) flag and
accordingly either “00” or “01” is stored in the location next to result.
ALGORITHM:
1. Start the program.
2. Load the HL pair with 16-bit address of data location.
3. Move the content of memory address in HL to accumulator.
4. Increment the address in HL pair.
5. Subtract the content of memory from accumulator.
6. Jump on No-carry to step 8.
7. Increment the C-register.
8. Store the content of accumulator and C-register.
9. Stop the program.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4100 21, 50, 41 LXI H,4150 Load data to HL Register
MANUAL CALCULATION:
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
4152
4150 68H 14H
(Result)
4153
4151 54H 00H
(Borrow)
INPUT OUTPUT
Address Data Address Data
4152
4150 57H F1H
(Result)
4153
4151 66H 01H
(Borrow)
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
4152
4150
(Result)
4153
4151
(Borrow)
RESULT:
Thus the assembly language program for 8-bit subtraction is executed and the
results are verified.
AIM: To write an assembly language program for the multiplication of two 8-bit
numbers, using 8085.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 Power supply unit 1
THEORY:
Using the immediate addressing mode instructions, the two operands to be multiplied
are loaded into two registers say, B and C. By the method of repeated addition, the
multiplication operation is performed (i.e., first number is repeatedly added to
accumulator as per the second number Eg. 03 x 04 => Acc + 03 (04 times) ). The
overflow in multiplication is checked every time after each addition, by verifying the
status of Carry (Cy) flag and accordingly a register, say D is incremented. The result
in accumulator is stored in the desired memory location and the content of D register
is stored in the location next to result.
ALGORITHM:
1. Start the program.
2. Clear the Accumulator and D Register.
3. Load the Data1 to B register and Data2 to C register.
4. Add the content of B to accumulator until C becomes zero.
5. If No-carry, go to step 6.
6. Increment the D-register.
7. Decrement the C register.
8. If C register is Non-zero, Jump to step 4.
9. Store the content of accumulator to 5000H.
10. Move the content of D-register to Accumulator.
11. Store the content of accumulator to 5001H.
12. Stop the program.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4500 3E, 00 MVI A,00 Move data to accumulator
Move multiplicand to b
4502 06, Data1 MVI B, Data1
register
Move the multiplier to c
4504 0E, Data2 MVI C, Data2
register
4506 16,00 MVI D, 00 Clear D-reg for carry
4508 80 LOOP2: ADD B repetitive addition
Jump on no carry to an
4509 D2, 0D, 45 JNC LOOP1
location LOOP1
Increment the D-register,
450C 14 INR D
if carry occurs.
450D 0D LOOP1: DCR C Decrement C-register
Jump on no zero to
450E C2, 08,45 JNZ LOOP2
Location LOOP2
4511 32,00,50 STA 5000 Store resultant product
Move carry to
4514 7A MOV A,D
accumulator
4515 32,01,50 STA 5001 Store the carry.
MANUAL CALCULATION
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
5000
4503 05H 19H
(Result)
5001
4505 05H 00H
(Carry)
INPUT OUTPUT
Address Data Address Data
5000
4503 41H 45H
(Result)
5001
4505 25H 01H
(Carry)
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
5000
4503
(Result)
5001
4505
(Carry)
RESULT:
Thus the assembly language program for 8-bit multiplication is executed and the
results are verified.
AIM: To write an assembly language program for the division of two 8 – bit
numbers, using 8085.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 Power supply unit 1
THEORY:
Using the immediate addressing mode instructions, the Divisor and Dividend are
loaded directly into Accumulator and B register. By the method of successive
subtraction, the division is carried out (i.e., Divisor is repeatedly subtracted from
Dividend, until the dividend becomes smaller than divisor Eg. 09 / 02 => 09 – 02 (4
times) => Remainder=01 and Quotient=04). The C register is incremented every
time after each subtraction, to keep count of the quotient. The final content in
accumulator will be remainder of the division and it is stored in the desired memory
location and the content of C register containing the quotient is stored in the location
next to result.
ALGORITHM:
1. Start the program.
2. Clear C Register.
3. Load the Divisor to Accumulator.
4. Load the Dividend to B-register.
5. Compare the B-register value with the accumulator.
6. If Accumulator content is smaller to B reg., then Jump to step 10.
7. Subtract B-register value with accumulator.
8. Increment the C-register.
9. Jump to step 4.
10. Store the contents of accumulator and C-register into memory.
11. Stop the program.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4500 3E, Divisor MVI A, Divisor Move Divisor to Acc
MANUAL CALCULATION:
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
4501 06H 5000 (R) 00H
4503 03H 5001 (Q) 02H
INPUT OUTPUT
Address Data Address Data
4501 25H 5000 (R) 02H
4503 05H 5001 (Q) 07H
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
4501 5000 (R)
4503 5001 (Q)
RESULT:
Thus the assembly language program for 8-bit division is executed and the results
are verified.
AIM: To write an assembly language program for the addition of two 16-bit
numbers, using 8085.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 Power supply unit 1
THEORY:
Using the direct addressing mode instructions, the two 16-bit numbers are loaded
into HL and DE register pairs from memory. Using the double addition instruction
(DAD rp), the contents of HL and DE are added together and the results are stored in
the HL register pair again. The B register is used to check the overflow of the above
addition, by verifying the carry flag. The result in the HL register pair is stored in the
desired memory location and the content of B register is stored in the location next
to result.
ALGORITHM:
1. Start the program.
2. Clear the B-register.
3. Load the Data1 to HL register pair.
4. Exchange the content of HL to the DE register pair.
5. Load the Data2 to HL pair register.
6. Add the content of HL and DE pair.
7. If no overflow in addition (no carry), go to step 9.
8. Increment the content of B-register.
9. Store the content of HL pair to the address 5504H.
10. Store the content of B-register to the address 5506H.
11. Stop the program.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4500 06,00 MVI B,00 Clear B register
MANUAL CALCULATION:
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
5504, 05
5500, 01 7167H F7ECH
(Result)
5506
5502, 03 8685H 00H
(Carry)
INPUT OUTPUT
Address Data Address Data
5504, 05
5500, 01 FF03H 06FEH
(Result)
5506
5502, 03 EF03H 01H
(Carry)
Exercise:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
5504, 05
5500, 01
(Result)
5506
5502, 03
(Carry)
RESULT:
Thus the assembly language program for 16-bit addition is executed and the results
are verified.
AIM: To write an assembly language program for the subtraction of two 16-bit
numbers, using 8085.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 Power supply unit 1
THEORY:
Using the direct addressing mode instructions, the two 16-bit numbers are loaded
into HL and DE register pairs. The lower bytes of the two numbers are subtracted
first using SUB instruction and the higher bytes of the same two numbers are
subtracted along with borrow using SBB instruction. The result in the accumulator
after each subtraction is stored in the two subsequent desired memory locations.
ALGORITHM:
1. Start the program.
2. Load the Data2 to HL register pair.
3. Exchange the content of HL to the DE register pair.
4. Load the Data1 to HL register pair.
5. Move the content of L register to Accumulator.
6. Subtract the content of E register from the Accumulator.
7. Store the result in accumulator to the memory location, 5100H.
8. Move the content of H register to Accumulator.
9. Subtract the content of D register from the Accumulator, along with borrow.
10. Store the result in Accumulator to the memory location, 5101H.
11. Stop the program.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
Load the Data2 to HL
4500 2A, 00,55 LHLD 5500
register.
Transfer the content
4503 EB XCHG
of HL to DE register pair.
Load the Data2
4504 2A, 02,55 LHLD 5002
to HL pair register.
Move the content of L
4507 7D MOV A,L
register to accumulator
Subtract E register and
4508 93 SUB E
accumulator
4509 32,00,51 STA 5100 Store the result
Move H register to
450C 7C MOV A,H
accumulator
Subtract D register and
450D 9A SBB D
accumulator
450E 32,01,51 STA 5101 Store the result.
MANUAL CALCULATION:
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
5500, 01 5100
6677H 1111H
(Data2) (Result)
5502, 03
7788H - -
(Data1)
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
5500, 01 5100
(Data2) (Result)
5502, 03
- -
(Data1)
RESULT:
Thus the assembly language program for 16-bit subtraction is executed and the
results are verified.
AIM: To write an assembly language program for arrange an array of 8-bit numbers
in ascending and descending order, using 8085.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 Power supply unit 1
THEORY:
This program uses the register indirect addressing mode instructions, to access the
data during sorting. The Bubble-Sort technique is used to sort the numbers in either
ascending order or descending order. The numbers to be sorted is stored in the
memory as a array with the first location containing the count of the data in the
array. The sorted numbers are stored back again in the same source location of the
array.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4100 06,00 AHEAD: MVI B,00 Clear the counter
Load Data addr to HL
4102 21,50,41 LXI H, 4150
pair.
4105 4E MOV C,M Move Array size to C-reg
4106 0D DCR C Decrement C reg
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
4150 4150
05H 05H
(Array Size) (Array Size)
4151 78H 4151 25H
4152 A6H 4152 37H
4153 42H 4153 42H
4154 25H 4154 78H
4155 37H 4155 A6H
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
4150 4150
(Array Size) (Array Size)
4151 4151
4152 4152
4153 4153
4154 4154
4155 4155
4156 4156
4157 4157
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4100 06, 00 AHEAD: MVI B,00 Clear the counter
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
4150 4150
05H 05H
(Array Size) (Array Size)
4151 78H 4151 A6H
4152 A6H 4152 78H
4153 42H 4153 42H
4154 25H 4154 37H
4155 37H 4155 25H
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
4150 4150
(Array Size) (Array Size)
4151 4151
4152 4152
4153 4153
4154 4154
4155 4155
4156 4156
4157 4157
RESULT:
Thus the assembly language program for sorting Ascending & Descending order is
executed and the results are verified.
AIM: To write an assembly language program to search the given data in an array.
APPARATUS REQUIRED:
THEORY:
This program uses the register indirect addressing mode instructions, to access the
data for searching a number from the array stored in the memory. The numbers to
be searched is loaded into the Accumulator and compared with the numbers of the
given array. Here again, the array has the data count stored in its first location. At
the end of searching, this program provides the information about the number of
times the given number is found in the array. The result is stored in the desired
memory location.
ALGORITHM:
1. Start the program.
2. Load the data address to the HL register pair.
3. Load the data to be searched in Accumulator.
4. Load the data count of array in the C register.
5. Initialize the B register with ‘00’.
6. Compare the memory content addressed by HL pair with Accumulator.
7. If not equal (zero flag is set); go to step 9.
8. Increment the B register.
9. Increment the HL register pair.
10. Decrement the C register by 1 and if not zero, go to step 6.
11. Store the content of B register in memory.
12. Stop the program.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
Load data to be searched
4100 3A, 50, 42 LDA 4250H
into Acc from memory
4103 21, 51, 42 LXI H, 4251H Set pointer for data array
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
4250 4200
75H 02H
(Data to be searched) (Result)
4251
06H
(Array size)
4252 23H
4253 75H The result shows the number of times,
4254 C1H the given number that was found in
the array.
4255 A7H
4256 75H
4257 12H
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
4250 4200
(Data to be searched) (Result)
4251
(Array size)
4252
The result shows the number of times,
4253
the given number that was found in
4254 the array.
4255
4256
RESULT:
Thus the assembly language program for searching the given data from an array is
executed and the result is verified.
AIM: To write an assembly language program for the sorting in ascending and
Descending order, using 8086.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8086-microprocessor kit. 1
2 Power supply unit 1
THEORY:
The Bubble-Sort technique is used to sort the numbers in either ascending order or
descending order. The numbers to be sorted is stored in the memory as a array with
the first location containing the count of the data in the array. The sorted numbers
are stored back again in the same source location of the array.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
1000 B9, 07, 00 MOV CX,07 Move data to CX reg
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
1100 00FFH 1100 00CCH
1102 0100H 1102 00FEH
1104 1101H 1104 00FFH
1106 00FEH 1106 0100H
1108 00CCH 1108 1101H
110A CDEFH 110A 1234H
110C ABCDH 110C ABCDH
110E 1234H 110E CDEFH
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
1100 1100
1102 1102
1104 1104
1106 1106
1108 1108
110A 110A
110C 110C
110E 110E
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
1000 B9, 07, 00 MOV CX,07 Move data to CX reg
SAMPLE DATA:
INPUT OUTPUT
Address Data Address Data
1100 00FFH 1100 CDEFH
1102 0100H 1102 ABCDH
1104 1101H 1104 1234H
1106 00FEH 1106 1101H
1108 00CCH 1108 0100H
110A CDEFH 110A 00FFH
110C ABCDH 110C 00FEH
110E 1234H 110E 00CCH
EXERCISE:
Execute the program with your own data and observe the results. Check the result
with your manual calculation.
INPUT OUTPUT
Address Data Address Data
1100 1100
1102 1102
1104 1104
1106 1106
1108 1108
110A 110A
110C 110C
110E 110E
RESULT:
Thus the assembly language programs for sorting- ascending & descending order was
executed are verified.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8086-microprocessor kit. 1
2 Power supply unit 1
THEORY:
A group of similar data stored in consecutive memory locations, representing a
variable can be celled as a String. Various operations can be performed on the string
data like, string copy, string compare, string store, string load, etc. The following
program helps to copy a string data from a source location to a destination location.
ALGORITHM:
1. Start the program.
2. Set the SI to point the source array and DI at destination location.
3. Move the string size to CX register.
4. Direction Flag is cleared so that SI & DI will auto increment after each loop.
5. Move the bytes of the string using MOVSB instruction.
6. Stop the program.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
Load offset address of
1000 BE, 00, 11 MOV SI, Source
Source to SI register
Load offset address of
1003 BF, 00, 12 MOV DI, Destination
destination to DI register
Number of array elements
1006 B9, FF, 00 MOV CX, 00FFH
in CX register
1009 FC CLD Clear Direction Flag (D)
100A A4 NEXT: MOV SB Move string byte
Decrement CX and Check
100B E2, FD LOOP NEXT for Zero. If not zero,
go to location NEXT
100D F4 HLT Stop the program
SAMPLE DATA:
EXERCISE:
Result of String manipulation:
RESULT:
Thus the string was moved from source to destination using the assembly language
of 8086.
AIM: To write an assembly language program to interface ADC and DAC with 8085
microprocessor kit.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 CRO 1
3 ADC & DAC interface board 1
4 Flat ribbon Cable 1
THEORY:
In a real time applications, processing of input data, conversion of data from digital
to analog and vice versa, are indispensable. The following program initiates the
analog to digital conversion process, checks the EOC pin of ADC 0809 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 in the memory.
ADC:
HARDWARE DETAILS:
ADC 0809 is a monolithic CMOS device, with an 8-bit analog-to-digital converter, 8
channel multiplexer and microprocessor compatible control logic.
Selected Address Lines in the Multiplexer of ADC 0809
Analog Channel Addr C Addr B Addr A
IN0 0 0 0
IN1 0 0 1
IN2 0 1 0
IN3 0 1 1
IN4 1 0 0
IN5 1 0 1
IN6 1 1 0
IN7 1 1 1
410C AF XRA A
Waste time to make A/D
410D AF XRA A
conversion to complete
410E AF XRA A
ALGORITHM:
OBSERVATION:
Execute this program and compare the data displayed at the LEDs with that of the
stored data at location 4150H.
Fig. 5.2 – Block diagram of the DAC interface with 8085 Kit.
DAC:
HARDWARE DETAILS:
The basic microprocessor board VBMB 002 incorporates two 8-bit DAC0800.
DAC0800 is a monolithic high-speed current output type. Its unique features are
SOFTWARE DETAILS:
1. Load the data 00h to Acc and send it to DAC to produce analog output of -5v.
2. Call time delay routine
3. Load the data FFh to Acc and send it to DAC to produce analog output of +5v.
4. Time delay routine is called again
5. A square wave of amplitude 10v (p-p) is produced, when steps 1 to 4 is
repeated continuously.
Delay Program
4119 05 DCR B
SAMPLE DATA:
EXERCISE:
Execute the program with different time delay and different input to DAC and
observe the results. Check the result with your manual calculation.
The amplitude and time period of Square wave form generated using DAC are
RESULT:
Thus the interfacing of ADC and DAC are performed using 8085 microprocessor kit.
AIM: To write an assembly language program to simulate digital clock using 8085.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 Power supply unit 1
THEORY:
The hours, minutes and seconds are entered at the memory location 4250, 4251 and
4252 in decimal form. The entered data is converted into Hex format from decimal
using a sub-routine. A delay of exactly 1 Sec is generated and after each delay, the
seconds, minutes and hours information is updated. The processing of data is done in
hex form and converted back into decimal before displaying.
ALGORITHM:
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
Main Program
410D 07 RLC
410E 07 RLC
410F 07 RLC
4110 07 RLC
4111 57 MOV D, A
4112 97 SUB A
4114 0D DCR C
4118 57 MOV D, A
411E 82 ADD D
411F 77 MOV M, A
4120 23 INX H
4121 05 DCR B
Opcode &
Address Label Mnemonics Comments
Operand
4134 CD, 4C, 41 CALL CONVERT
413A 23 INX H
413F 4F MOV C, A
4140 05 DCR B
4148 C0 RNZ
4149 91 SUB C
414A 77 MOV M, A
414B C9 RET
4153 14 INR D
415C 7A MOV A, D
415D 0F RRC
415E 0F RRC
415F 0F RRC
4160 0F RRC
4161 57 MOV D, A
4165 82 ADD D
4166 C9 RET
Opcode &
Address Label Mnemonics Comments
Operand
Display Routine
416C 07 RLC
416D 07 RLC
416E 07 RLC
416F 07 RLC
417B C9 RET
417F 83 ADD E
4180 5F MOV E, A
4181 1A LDAX D
4184 C9 RET
4197 DB, 08 IN 08
4199 5F MOV E, A
419A DB, 08 IN 08
419C B3 ORA E
Opcode &
Address Label Mnemonics Comments
Operand
419D C2, 93, 41 JNZ L03
41A0 0D DCR C
41A4 2B DCX H
41A5 34 INR M
41A6 7E MOV A, M
41AE 77 MOV M, A
41AF 2B DCX H
41B0 34 INR M
41B1 7E MOV A, M
41B9 77 MOV M, A
41BA 2B DCX H
41BB 34 INR M
41BC 7E MOV A, M
41C4 77 MOV M, A
Opcode &
Address Label Mnemonics Comments
Operand
Look Table (Codes) for display from ‘0’ to ‘F’
OUTPUT:
Enter the Time information (hours, minutes and seconds) at 4250, 4251 and 4252
respectively. Execute the program and look for digital clock being displayed at the 7-
segment display of the microprocessor kit.
RESULT:
Thus, the program for simulating digital clock in the 8085 microprocessor kit is
executed and the display was verified.
AIM: To write a program to study 8279 Keyboard and display controller and also
initialize 8279 for rolling message in the display.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-microprocessor kit. 1
2 8279 – Keyboard and display controller board 1
3 Flat ribbon Cable 1
THEORY:
Intel 8279 is responsible for key debouncing, coding of the keyboard matrix and
refreshing of the display elements in the microprocessor based system. Its main
functions are:
DESCRIPTION:
In the 8279 Keyboard and display interfacing, we adopt the mode in which we
want to operate the keyboard and display by initializing it. The clear display
command is executed to clear all the rows of the display RAM. The data to be
displayed is fetched from Display RAM and displayed at first digit of display. A
counter is initialized and its value is decremented until all the values are displayed. A
delay is set such that the display is made for a period. The write display RAM
Command word is used it set the auto increment flag.
The various command words of 8279 are:
0 0 0 D D K K K
DD:
0 0 8 character display-left entry.
0 1 16 character display-left entry.
1 0 8 character display-right entry.
1 1 16 character display-left entry.
KKK:
0 0 0 Encoded scan keyboard-2 key lockout.
0 0 1 Decoded scan keyboard-2 key lockout.
0 1 0 Encoded scan keyboard-N key lockout.
0 1 1 Decoded scan keyboard-N key lockout.
1 0 0 Encoded scan sensor matrix.
1 0 1 Decoded scan sensor matrix.
1 1 0 Strobed input encoded scan display.
1 1 1 Strobed output decoded scan display.
CLEAR HISTORY:
1 1 0 CD CD CD CF CA
CD CD CD
0 x A0-3 B0-3 = 00 (0000 0000)
0 0 A0-3 B0-3 = 00 (0000 0000)
1 0 A0-3 B0-3 = 20 (0010 0000)
1 1 A0-3 B0-3 = FF (1111 1111)
Enables clear display when CD=1, the rows of display are cleared by the code set by
lower two CD bits
CF-> If CF=1, FIFO status is cleared, interrupt O/P line is reset sensor RAM
pointer is set to row 0.
CA-> Clear all bits has the combined effect of CD and CF. If uses the CD clearing
mode on display RAM and clears FIFO status. It also resynchronizes the
internal timing chain.
1 0 0 AI A A A A
DU S/E O U F N N N
0 1 0 AI X A A A
1 1 1 E X X X X
X=don’t ‘care
If during a single debounced cycle, two keys are found pressed, this is considered as
simultaneous multiple depression and sets error flag. This flag prevent any further
writing into FIFO and set interrupt. This error flag is rest by sending the normal clear
command CF=1.
PROGRAM CLOCK:
0 0 1 P P P P P
All timing and multiplexing signals for the 8279 are generated by an internal
Prescaler. This Prescaler divides the external clock (pin 3) by a programmable
integer. Bits PPPPP determine the value of this integer which ranges from 2 to 31.
Choosing a divisor that yield 100KHZ will give the specified scan and debounce times.
For instance if pin 3 of the 8279 is being cluched by 2MHZ signal, PPPPP should be
set to 10100 to divide the clock by 20 to yield the proper 100KHZ operating
frequency.
0 1 1 AI A A A A
The CPU sets up the 8279 for a read of the display RAM by the first writing this
command. The address bits AAAA select one the 16 rows of the display RAM. If the
AI flag is set this row address will be incremented after each of the following read
and write operation of display RAM. Since the same counter is used for both reading
and writing this command sets the next read or write address and the sense of the
auto increment mode for both operations.
1 0 1 X 1W 1W BL BL
The 1W bits can be used to mask nibble A and nibble B in applications requiring
separate 4-bit display.
8279 Output A3 A2 A1 A0 B3 B2 B1 B0
Data Bus D7 D6 D5 D4 D3 D2 D1 D0
Segments d c b a dp g f e
Note:
It must be noted that, ‘0’ in segment makes it glow and ‘1’ makes it blank.
ALGORITHM:
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4100 06, 08 MVI B, 08H Load count for no. of char.
RESULT:
Thus the Program of Interfacing 8279 Keyboard and Display is executed and verified.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085-Microprocessor kit. 1
2 8259–Programmable interrupt controller board 1
3 Flat ribbon Cable 1
HARDWARE DESCRIPTION:
The 8259 interface board comprises of the programmable Interrupt Controller, Intel
8259. The 8259 serves as an interface between interrupt request sent from multiple
I/O devices and the 8085 processor which is connected to INTR interrupt pin. Thus, it
functions as a overall manager in an interrupt driven system environment.
• The 8259 are designed to minimize the software and real time
overhead in handling multilevel priority interrupts. It has several
modes permitting optimization for a variety of S/M requirements.
D7 D6 D5 D4 D3 D2 D1 D0
A7 A6 A5 1 LTIM ADI SNGL IC4
D7 D6 D5 D4 D3 D2 D1 D0
Master S7 S6 S5 S4 S3 S2 S1 S0
Slave 0 0 0 0 0 ID3 ID2 ID1
• Master mode:
1 indicates slave is present on that interrupt, 0 indicates direct interrupt
• Slave mode:
ID3-ID2-ID1 is the slave ID number. Slave 4 on IR4 has ICW3=04h (0000
0100)
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 SFNM BUF M/S AEOI Mode
D7 D6 D5 D4 D3 D2 D1 D0
M7 M6 M5 M4 M3 M2 M1 M0
D7 D6 D5 D4 D3 D2 D1 D0
D7 ESMM SMM 0 1 MODE RIR RIS
THEORY:
When one or more the Interrupt requests are received from I/O devices through the
interrupt Request lines (IR0-IR7), the corresponding (IRR bits) are set in IRR
register. The 8259 evaluates these requests and send an Interrupt signal to the CPU
through INTR. The CPU upon receiving the Interrupt request from 8259, it responds
back with an Interrupt Acknowledge signal through INTA. Upon receiving an INTA
from the CPU, the highest priority bit is set in Interrupt Service Register (ISR) and
the corresponding IRR bit is reset and 8259 also releases a CALL Instruction code
(1100 1101) onto the 8 bit data bus through its D7-D0 pins. On receiving the opcode
for CALL instruction from 8259, the processor (8085) initiates two more INTA signals
to the 8259. These two INTA signals allow the 8259 to release its preprogrammed
interrupt subroutine (ISR) address on to the data bus. The lower 8-bit address is
released at the first INTA signal and the higher 8-bit address is released at the
second INTR signal. In the AEOI (Automatic End of Interrupt) mode, the ISR bit is
reset of the end of the third INTA signal otherwise the ISR bit remains set until an
appropriate EOI command is issued at the end of interrupt sequence.
ALGORITHM:
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4100 3E, 17 MVI A, 17H
5004 CF RST1
OBSERVATION:
If you press the switch IR0 (when Acc is loaded with data ‘FE’), the CPU jumps to the
location 5000H. The 8259 will not accept any more interrupt at IR0, since AEOI is not
set. The end of interrupt (EOI) should be given through OCW2 in ISR program at
5000H.
Upon pressing the IR0 switch in the 8259 interface board, the ISR program at 5000H
automatically makes the 8085 trainer kit to get resetted.
The value loaded into Acc for selecting the interrupt request switch in 8259 interface
board can be changed. Upon executing of the main program again, we can see the
kit getting resetted on pressing of selected interrupt switch at the 8259 interface
board.
RESULT:
Thus the 8259 Interface board is connected with 8085 and its operation is
understood.
CONTROL FORMAT:
AIM: To write a program to study 8253 Timer and verify its modes of operation.
APPARATUS REQUIRED:
Hardware Description:
-----------------------------------------------------------------------------------------------
MODE 0 - Interrupt on Terminal Count
Set the Channel 0 in Mode 0. Connect ‘CLK0’ to the debounce circuit and execute the
following program.
Opcode &
Address Label Mnemonics Comments
Operand
4100 3E, 30 MVI A,30H
Set Channel-0 in Mode-0
4102 D3, CE OUT CEH
Using a CRO, observe the output of Channel 0 is initially low. After giving six clock
pulses, we may notice that the output goes high.
After loading the counter, the output will remain low following the rising edge of the
gate input. The output would go high on the terminal count. It is retriggered hence
the output will remain low for the full count after any rising edge of gate input.
Initialize channels of 8253 in mode 1 and also initiates triggering of gate-0 and 0
goes low clock pulse after triggering the gate and goes back to high level after file
clock pulses.
Opcode &
Address Label Mnemonics Comments
Operand
4100 3E, 32 START MVI A, 32H
Set Channel-0 in Mode-1
4102 D3, CE OUT CEH
Execute the grogram, give clock pulses through the denounce logic and verify using a
CRO.
It is a simple divide by N counter. The output will be low for one period of the input
clock. The period from one output pulse to the next, equals the number of input
counts in the count register. If the count register is reloaded between output pulses,
the present period will not be affected, but subsequent period will reflect the new
value.
Using mode 2, let us divide the clock pulse of the channel 1 by 10. Connect the CLK1
to PCLK.
Opcode &
Address Label Mnemonics Comments
Operand
4100 3E, 36 START MVI A, 36H
Set Channel-1 in Mode-2
4102 D3, CE OUT CEH
In a CRO, observe continuously the Input clock to Channel-1 and output at OUT-1
OUTPUT:
Mode 2: Input: 05 Clock pulse, Clock 4th Pin, grounded – 10th Pin.
Output: Toggled after 5th clock pulse and this is repeated.
Amplitude Amplitude
RESULT:
Thus the program for interface of programmable timer was executed and the outputs
were verified.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8085–Microprocessor kit. 2
2 8251–USART Interface board 2
3 Flat ribbon Cable 2
4 RS-232C Cable 1
HARDWARE DESCRIPTION:
IC 8251 – USART (Universal Synchronous / Asynchronous Receiver Transmitter)
The control pins with which the 8251 A communicates with the CPU are the RESET,
CLK WR, RD, CS, and D0-D7
The 8251A is used as the serial port on SDIC-86 boards. It is also used on the IBM
PC synchronous communication board and on many other boards. The D0-D7 act as
data bus the chip select is input is connected to an address decoder so the device is
enabled when addressed.
C/D means control or data is to be write read. RD read data command. WR write
data or Control command. The TXC is the transmit shift register clock input RXC is
the receive shift register input when connected with another system for several
communication the signals. With connect with CTS, RTS, TXD and RXD signals of that
system
CTS: Clear to send: Enable 8251 to transmit several data
RTS: Request to send: When low, indicates that 8251 can receive serial data
TXD: Transmit serial data
RXD: Receive serial data.
MASTER PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4100 3E, 36 START MVI A, 36
Mode set from 8253
4102 D3, CE OUT CEH
411F CF RST 1
The two microprocessor trainer kits are connected serially via RS232 standard cable.
The Master program is stored in memory location 4100H of first trainer kit (Tx-
Transmitter End) and Slave program is stored in the memory location 4200H of
second trainer kit (Rx-Receiver End).
Here Polling technique is used to send and receive the serial data.
MASTER PROGRAM
ALGORITHM:
SLAVE PROGRAM
ALGORITHM:
SLAVE PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4200 3E, 36 START MVI A, 36
Mode set for 8253
4202 D3, CE OUT CEH
Remember to first make the receiver program is executed and receiver end is kept
ready for reception of the serially transmitted data.
OUTPUT:
MICROPROCESSOR KITS DATA
Master (Tx) Transmitted data 41H
RESULT:
Thus the serial interface program for communication between two microprocessor
kits using RS-232C was executed and the results are verified.
AIM: To establish the parallel communication between two microprocessor kits using
8255 PPI interface.
APPARATUS REQUIRED:
S.No. Item Description Qty
1 8085–Microprocessor kit. 2
2 8255–PPI Interface board 2
3 Flat ribbon Cable 3
HARDWARE DESCRIPTION:
The Intel 8255A is a general purpose programmable I/O device which is designed for
parallel communication between microprocessors and peripheral devices. It provides
24 I/O pins which may be individually programmed in 2 groups of 12 and used in 3
major modes of operation.
The 8255 allows the following three operating modes (Modes 0, 1 and 2):
• Mode 1 – Handshake I/O Mode: Same as Mode 0 but Port C is used for
handshaking and control.
In the given program, Port A is used for transmission and reception of parallel data
between the two microprocessor kits. Port A of 8255 interface in Tx end is selected in
Mode 0 – Output mode and Port A of 8255 interface in Rx end is selected in Mode 0 –
Input mode.
CONTROL WORD
for I/O MODE:
BSR MODE:
The two microprocessor trainer kits are connected parallel through 8255 interface.
The Master program is stored in memory location 4100H of first trainer kit (Tx-
Transmitter End) and Slave program is stored in the memory location 4100H of
second trainer kit (Rx-Receiver End).
Here Polling technique is used to send and receive the parallel data.
MASTER PROGRAM
ALGORITHM:
SLAVE PROGRAM
ALGORITHM:
411A 23 INX H
411B 0D DCR C
411F CF RST1
DELAY Routine
4158 05 DCR B
415C C9 RET
PROCEDURE:
3. Load the block of data at memory location 4500H in the transmitting end kit.
6. Check for the transfer of parallel data from Tx kit to Rx kit, by verifying the
data at location 4400H in the Rx kit.
OUTPUT:
MICROPROCESSOR KITS
Transmitter End (Tx) Receiver End (Rx)
4500 4400
4501 4401
4502 4402
4503 4403
4504 4404
4505 4405
4506 4406
4507 4407
4119 77 MOV M, A
411D 23 INX H
411E 0D DCR C
4122 CF RST1
DELAY Routine:
4158 05 DCR B
415C C9 RET
Note:
Remember to make the program in Rx end to get executed first and receiver end is
kept ready for reception of the parallel transmitted data.
RESULT:
Thus the program for parallel communication between two microprocessor kits using
8055 was executed and the results were verified.
Fig. 12.2 – Bock diagram for stepper motor interface with 8085 kit
AIM: To write a program to interface and program of stepper motor with 805.
APPARATUS REQUIRED:
THEORY:
Stepper Motor:
A DC motor, in which the rotor makes only discrete angular movements in steps, is
called a Stepper Motor. The Stepper motor controlled by a microprocessor has variety
of applications in control system area and in process automations like, machine tools,
robotics, CNC lathes, etc.
There are four windings in the Stator, named as A1, B1, A2, B2 and the Rotor has
three permanent magnets in it. The arrangement of stator and rotor can be seen in
figure 12.1. The movement occurs in the rotor in a stepwise manner, from one
equilibrium to the next.
Where, ‘Nr’ is no. of pairs of poles in rotor and ‘Ns’ is the no. of poles in stator
Note: With Ns=4 and Nr=3; Step size in the stepper motor will be 30°
To make stepwise movement in the rotor of stepper motor, the coil windings in the
stator have to be energized appropriately.
The three different schemes for step movements in rotor of a stepper motor are,
a) Wave scheme
b) 2-phase scheme
c) Half or Mixed scheme
A. Wave Scheme:
In this scheme, the coil windings (A1, B2, A2, B1) of the stator of stepper motor are
cyclically excited with a DC current, to make clockwise movement in steps and in
reverse order for anti-clockwise movements.
B. 2-Phase Scheme:
In this scheme, the two adjacent coil windings (A1-B2, B2-A2, A2-B1, B1-A1) of the
stator of stepper motor are cyclically excited with a DC current, to make clockwise
movement in steps and in reverse order for anti-clockwise movements.
C. Half Scheme:
In this scheme, we obtain the movement of rotor in half of the original step size, by
interleaving these two schemes.
Note: ‘1’ in the table indicates the supply of DC current to the stator coil winding.
Format of Data storage (in Lookup table) for DC current to the stator coil windings,
are as follows.
D7 D6 D5 D4 D3 D2 D2 D1
0 0 0 0 A1 A2 B1 B2
Example:
ALGORITHM:
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4100 21, 50, 41 START: LXI H, 4150 Load Lookup table addr to HL
410C 1B DCX D
Delay Program
410D 7B MOV A, E
410E B2 ORA D
LOOKUP Table
OUTPUT:
Execute the program and observe the movement of stepper motor.
Note:
2. To vary the speed of rotation, change the delay time in the program.
RESULT:
Thus the stepper motor is interfaced with 8085 processor and program for the control
of stepper motor is executed to verify the direction of rotation in both forward and
reverse direction and change in speed of rotation.
AIM: To write an assembly program to control the speed of DC motor using 8085 kit.
APPARATUS REQUIRED:
THEORY:
Principal of Operation:
The speed of the motor varies with input supply power. Hence, by varying the input
voltage to the motor, the speed of DC motor can be varied. The speed measurement
is based on the principle that the motor rotation is converted into pulses using optical
pickup sensor and the pulses are used to decrement a counter for a known time. This
count value can be calibrated to RPM, which is the standard unit for speed
measurement.
This program illustrates the concept of setting the speed of DC motor and read the
count value from channel-0 of the counter. To make up this functions, the following
procedures to be adapted.
PROGRAM:
Opcode &
Address Label Mnemonics Comments
Operand
4100 3E, FF MVI A, 0FFH Move data FFH to C reg
4102 D3, C0 OUT C0H DAC OUT port
4104 3E, 00 MVI A, 00H Clear acc
4106 D3, D8 OUT D8H Initialize gates as low
4108 CD, 2B, 41 CALL DELAY Call delay for stable running
Initialize mode as
410B 3E, 30 MVI A, 30H
interruption terminal count
410D D3, CE OUT CEH Time control port
410F 3E, FF MVI A, FFH Maximum data
Initialize Timer port CH0
4111 D3, C8 OUT C8H
(LSB)
Initialize Timer port CH0
4113 D3, C8 OUT C8H
(MSB)
4115 3E, 00 MVI A, 00H Clear acc
4117 D3, D0 OUT D0H Make gate high
4119 CD, 2B, 41 CALL DELAY Call delay for 1 sec
411C 3E, 00 MVI A, 00H Clear acc
411E D3, D8 OUT D8H Make gate low
4120 DB, C8 IN C8H Data in from CH0
4122 32, 00, 45 STA 4500H Store data in memory
4125 3E, 00 MVI A, 00H Clear acc
4127 32, 01, 45 STA 4501H Clear buffer
412A 76 HLT Stop the program
1 Second DELAY Routine
412B 0E, 03 DELAY MVI C, 03H Move 03H to C reg
412D 21, C3, A3 LOOP1 LXI H, A3C3H Load data in HL pair
4130 2B LOOP DCX H Decrement HL pair addr
4131 7D MOV A, L Move L reg content to acc
OR Acc content with H reg
4132 B4 ORA H
content
4133 C2, 30, 41 JNZ LOOP Jump on no zero to LOOP
4136 0D DCR C Decrement C reg
4137 C2, 2D, 41 JNZ LOOP1 Jump on no zero
413A C9 RET Return to main program
OUTPUT:
The determined counter value representing the speed is stored in memory location as
shown below.
OUTPUT
Determined counter
Memory Location
Value
4500
4501
RESULT:
Thus the speed of DC motor was controlled with 1 sec time delay using 8085
microprocessor kit.
Flow Chart:
AIM: To write an assembly language program for the arithmetic, logical and bit
manipulation using 8051.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8051–Micro Controller kit. 1
2 Power Supply unit 1
ALGORITHM:
1. Start the program.
2. Get the LSB of 1st and 2nd operands.
3. Add the LSB of the two operands and store it in memory.
4. Get the MSB of 1st and 2nd operands.
5. Add the MSB and store the result in memory
6. Stop the program.
INPUT OUTPUT
Address Data Address Data
4102 4500
4104 4501
410B - -
410D - -
Flow Chart:
ALGORITHM:
1. Start the program.
2. Clear the carry flag and load the first operand in accumulator.
3. Get the 2nd operand and subtract it from accumulator.
4. Store the result in memory.
5. Stop the program.
INPUT OUTPUT
Address Data Address Data
4102 4500
4104 - -
Flow Chart:
ALGORITHM:
1. Start the program.
2. Load the 1st operand in A and 2nd operand in B.
3. Multiply A and B contents using MUL instruction.
4. Store the result in memory.
5. Stop the program.
INPUT OUTPUT
Address Data Address Data
4101 4500
4104 4501
Flow Chart:
Opcode &
Address Label Mnemonics Comments
Operand
4100 74, Data1 MOV A, #DATA1 Move Dividend to Acc
ALGORITHM:
1. Start the program.
2. Get 1st operand in A and 2nd in B.
3. Divide A by B contents using division instruction.
4. Store the result in memory.
5. Stop the program.
INPUT OUTPUT
Address Data Address Data
4500
4101
(Quotient)
4501
4104
(Remainder)
Flow Chart:
PROGRAM (OR):
Opcode &
Address Label Mnemonics Comments
Operand
4100 74, Data1 MOV A, #DATA1 Move Data1 to Acc
ALGORITHM:
1. Start the program.
2. Load 1st operand in Accumulator.
3. Get 2nd operand and perform OR between Acc and 2nd Operand.
4. Store the result in memory.
5. Stop the program.
OUTPUT OF OR Operation:
INPUT OUTPUT
Address Data Address Data
4101 4500
4103 - -
Flow Chart:
PROGRAM (AND):
Opcode &
Address Label Mnemonics Comments
Operand
4100 74, Data1 MOV A, #DATA1 Move Data1 to Acc
INPUT OUTPUT
Address Data Address Data
4101 4500
4103 - -
RESULT:
Thus the programs involving arithmetic, logical and bit manipulation using 8051 are
executed and its results are verified.
Aim: To communicate microcontroller kit and PC using the stepper motor in both
forward and reverse direction with delay program.
APPARATUS REQUIRED:
S.N o Item Description Qty
1 8051–Micro Controller kit. 1
2 Stepper Motor 1
3 PC with Cross assembler software 1
4 Flat Ribbon Cable & RS232C Cable 1 Each
Theory:
The software which is used to compile (convert) the assembly language program into
a machine suitable for a particular processor, is called Cross Assembler. This
converted machine code is sent to the trainer kit through the serial cable (RS232)
and executed in the trainer kit.
CROSS ASSEMBLER:
You may use any text editor such as Notepad in Windows to edit your 8051 program.
Then you can assemble and link your program so as to make it loadable to the 8051
trainer kit for its execution.
ASSEMBLING:
Suppose your program is ready and is now stored in the working directory where the
8051 cross assembler and the 8051 linker are in, Run X8051.exe to activate the
cross assembler.
Figure C1 shows the user interface of the cross-assembler. In the interface, the cross
assembler will prompt for inputting listing destination, input filename and output
filename. You have to specify the input filename. As for others, you can skip them by
just entering ENTER key. If no error is detected by the cross-assembler, an object file
with extension ‘.obj’ will be generated.
LINKING:
Run Link.exe to activate the linker. Figure C2 shows the user interface of the linker.
The linker will prompt for inputting parameters. All you need to do is to specify the
input filename. It should be an object file with extension ‘.obj’. As an example, Figure
C2 shows the case that the input file is “Stepper.obj”. You can skip all other prompts
by just entering ENTER key. If no error is detected, a binary file with extension ‘.hex’
will be generated.
The assembled program will be loaded into external memory of the 8051 trainer kit
through serial communication interface with PC and the same can be executed from
the trainer kit.
Algorithm:
4100 90, 45, 00 START: MOV DPTR, #4500H Load address to DPTR
Result:
Thus the program for stepper mot or interface with 8051-microcontroller kit through
PC was executed and its parameters like speed, direction was observed.
APPENDIX A
8085 OPCODE SHEET
DATA TRANSFER:
MOV AX, [a16] A1, ___, ___
MOV [a16], AX A3, ___, ___
MOV AX, DX 8B, C2
MOV AL, d8 B0, ___
MOV AH, d8 B4, ___
MOV [a16], AL A2, ___, ___
MOV [a16], AH 88, 26, ___, ___
MOV AL, AH 8A, C4
MOV AH, AL 88, C4
MOV BP, AX 8B, E8
I/O:
OUT a8, AL E6, a8
IN AL, a8 E4, a8
ARITHMETIC:
ADD AL, d8 04, ___
ADD AX, [a16] 03, 06, ___, ___
ADC AX, [a16] 13, 06, ___, ___
INC BX 43
INC AL FE, C0
INC SI 46
INC DI 47
DEC BL FE, CB
DEC CH FE, CD
DEC CX 49
LOGICAL:
AND AL, d8 24, ___
AND AX, d16 25, ___, ___
AND AH, BL 22, E3
NOT AX F7, A0
CMP AH, AL 38, C4
STRING MANIPULATION
MOVSB A4
STOSB AA
CLD FC
STD FD
CLI FA
STI FB
ITERATION CONTROL
LOOP rel E2, rel_
BRANCHING:
JMP rel EB, rel_
JNC rel 73, rel_
JNZ rel 75, rel_
JZ rel 74, rel_
Note:
Data Addr refers to 8-bit (direct) address of Internal RAM memory location / SFR
Code Addr refers to 8-bit relative addressing from the current location
APPENDIX B
Keep repeating the last two steps until entire data / Program is stored.