NANDHA ENGINEERING COLLEGE
(Autonomous Institution)
Erode-638 052
LAB MANUAL CUM
RECORD NOTE BOOK
13EC314 – MICROPROCESSOR AND INTERFACING
LABORATORY
III-Semester
B.E (COMPUTER SCIENCE AND ENGINEERING)
PREPARED BY:
S.KAVITHA – AP/CSE
E.PADMA – AP/CSE
NANDHA ENGINEERING COLLEGE
Erode-638 052
(AUTONOMOUS)
BONAFIDE CERTIFICATE
Register Number:
Certified that this is the Bonafide Record of work done by.……….. of the Third Semester B.E COMPUTER SCIENCE AND ENGINEERING branch during the Academic Year
2014-2015
in the 13EC314 – MICROPROCESSOR AND INTERFACING LABORATORY.Staff-in-charge Head of the Department
Submitted for the End Semester Practical Examination Held on……….
13EC314 – MICROPROCESSOR AND INTERFACING LABORATORY III – Semester
B.E (COMPUTER SCIENCE AND ENGINEERING) SYLLABUS
1. Study Experiments
i) Study of 8086 Architecture ii) Study of 8255 – PPI
iii) Study of 8253 – PIT iv)Study of 8279 – PKI v)Study of 8259 – PIC
2. Write an ALP to find out factorial of a given hexadecimal number using 8086 MP Data: OAH, OFH, 1OH
3. Write an ALP to perform 16 bit arithmetic operations (ADD, SUB, MUL, and DIV) 4. Write an ALP to generate the sum of first ‘N’ natural numbers using 8086 MP
5. Write an ALP to convert given hexadecimal number to binary using 8086 MP Data: ABH, CDH, 101H
6. Write an ALP to convert given binary number to hexadecimal number using 8086MP Data: 101010102, 111111112, 11002, 11112(Represent as ASCII)
7. Write an ALP to order given set of hexadecimal numbers in ascending and descending order
Data: 0AH, 0FH, 0DH, 10H, 02H
8. Write an ALP to move block of data from locations 1200H-1205H to 2200H – 2205H 9. Write an ALP to reverse the given string
Data: WELCOME
10. Write an ALP to generate the following series 1+1/x+1/x3+1/x5+ …….. 11. Write an ALP to generate square wave using 8255 PPI
12. Write an ALP to generate rate generator using 8253 PIT 13. Write an ALP to interface keyboard with 8086 using 8279 PKI
14. Write an ALP to display the given message using 8279 PKI Message: COMPUTER SCIENCES
INDEX
Ex. No. DATE NAME OF THE EXPERIMENTS PAGE
NO. MARKS SIGN
1.
Study Experiments
i) Study of 8086 Architecture ii) Study of 8255 – PPI
iii) Study of 8253 – PIT iv) Study of 8279 – PKI v) Study of 8259 – PIC
2. Factorial of a given hexadecimal number
using 8086 MP
3. 16 bit arithmetic operations
4. sum of first ‘N’ natural numbers using 8086
MP
5. Conversion of given Hexadecimal number to
binary using 8086 MP
6. Conversion of given binary number to
hexadecimal number using 8086MP
7. Ordering given set of hexadecimal numbers
in ascending and descending order
8. Moving a block of data from locations
1200H-1205H to 2200H – 2205H
9. Reversing the given string
10. Generating the following series
1+1/x+1/x3+1/x5+ ……..
11. Generating square wave using 8255 PPI
12. Generate rate generator using 8253 PIT
13 Interface keyboard with 8086 using 8279
PKI
14. Interface analog to digital converter AVERAGE MARKS AWARDED
Ex.No.:
DATE:
STUDY EXPERIMENTS
AIM:
To Study the Architecture of 8086 , Study of 8255 – PPI, Study of 8253 – PIT, Study of 8279 – PKI and Study of 8259 – PIC.
Introduction:
Before getting into 8086 lets 1st define microprocessor. in simple words, a microporcessor is an electronic device which computes on the given input similar to CPU of a computer. it is made by fabricating millions(or billions) of transistors on a single chip.
Intel 8086:
The 8086 is a 16-bit microprocessor chip designed by Intel corporation in between early 1976 and mid-1978.pin configuration:- picture below shows the 8086 pin-assignments in min and max mode:
Features of 8086
:-1. 8086 is a 40 pin IC. 2. It is a 16-bit processor.
3. its operating voltage is 5 volts. 4. its operating frequency is 5 MHz.
6. It has 16-bit data bus and 20-bit address bus. 7. it has fourteen 16-bit registers.
8. higher throughput(speed).
9. It has around 20000 transistors in its circuitary and it is made in HMOS technology.
8255 PPI CHIP WORKING PRINCIPLE :
After completing this experiment, you should know the different operation modes of an 8255 PPI chip and how to configure the chip to operate in a particular operation mode. You should also know how to use handshaking to transfer data in an interface.
Background
The 8255 PPI chip is a general purpose programmable I/O device which is designed for use with all Intel and most other microprocessors. The 8255 has 24 I/O pins divided into 3 groups of 8 pins each. The groups are denoted by port A, port B and port C respectively. Every one of the ports can be configured as either an input port or an output port.
The 8255 can be programmable in three different modes:
• Mode 0: simple unidirectional input/output without handshaking
• Mode 1: unidirectional input/output with handshaking via some pins of port C • Mode 2: bidirectional input/output with handshaking via some pins of port C
Handshaking is a common technique used to transfer data in an interface. A computer and a device usually operate at different system clock rates and hence the data transfer between their corresponding I/O interface may not be so reliable. For example, the device might not be fast enough to catch the data transmitted from the CPU. Handshaking provides a means to improve the reliability of a data transfer.
Method and details
In this lab, you will study how to program an 8255 PPI chip to operate in different operation modes with an 8051 evaluation board and an 8255 evaluation board. Figure 1 shows the setup of the system. You are requested to modify some given 8051 program modules with a text editor in a
computer. The modified programs, when they are run in the 8051 evaluation board, should be able to program port A and port B of the 8255 in the 8255 evaluation board to operate in one of their operation modes. You can assemble and link your program modules with the provided cross-assembler and linker to generate executable files. Executable files can then be loaded to the 8051 evaluation board via the printer port of the computer to program the on-board AT89S8252. The AT89S8252 is a low-power, high -performance CMOS 8-bit microcomputer with 8K bytes of Downloadable Flash programmable and erasable read only memory and 2K bytes of EEPROM. The device is manufactured by Atmel and is compatible with the industry standard 80C51 instruction set and pinout.
printer Computer port 8051 8051 8255 evaluation evaluation local bus board board
Figure 1. Setup of the system
After programming the AT89S8252, the AT89S8252 executes the loaded program to configure the 8255 and the ports of the 8255 should operate in the desired modes.
As there are 3 ports in 8255 and each one of them can be programmed as an input or output port, there are a number of possible configurations. In this lab, four configurations given in Table 1 will be studied.
configuration Port A Port B Port C 1 Mode 0, input Mode 0, output Don’t care
2 Mode 1, input Mode 0, output Handshake for port A 3 Mode 0, input Mode 1, output Handshake for port B
4 Mode 1, input Mode 1, output Handshake for ports A and B
TABLE 1: CONFIGURATION OF 8255 STUDY OF 8253-PIT
The Intel 8253 is a programmable counter/timer chip designed for use as an Intel microcomputer peripheral.• It is packaged in a 24-pin plastic DIP.• Six programmable timer modes allow the 8253 to be used as an event counter, elapsed time indicator, programmable one-shot, and in many other applications e.g., to create different intervals.
• It has 3 counters: Counters 0, 1, 2
•Each counter in the block diagram has 3 lines connected to it. Two of these lines,clock and gate, are inputs. The third, labeled OUT is an output. The function of these lines changes and
depends on how the device is initialized or programmed.
INTERPRETATION OF THE TIMER CONTROL BYTE:
• Bits 7,6: Counter Selection (00 to 10)
• Bits 5,4: Read/load mode for 2-byte count value: 00 -- latch count for reading
01 -- read/load high byte only 10 -- read/load low byte only
11 -- read/load low byte then high byte
• Bits 3,2,1: Count mode selection (000 to 101)
• Bit 0: 0/1- Count in binary/BCD.
MODES OF OPERATION OF 8253:
There are 6 modes of operation of 8253 . Differences in modes are:
– “OUT” signal in different shapes like low-high or high- low, periodic or non-periodic – How to trigger/start the counter
• Mode 0 and 1 are same in shape (non-periodic) • Mode 4 and 5 are same in shape (non-periodic) • Mode 2 and 3 are almost same in shape(periodic)
MODES OF OPERATION OF 8253:
• Mode 0: Set Output Bit when timer done.
The output will start off zero. The count is loaded and the timer will start to count down. When the count has reached zero the output will be set high, and remain high until the next count has been reloaded.
• Mode 1: Programmable One-Shot.
The output will go low following the rising edge of the gate input. The counter will count and the
• Mode 2: Rate Generator. The counter will continually count down, when the count reaches zero, the output will pulse low and the counter will be reloaded.
• Mode 3: Square Wave Generator.
This mode is similar to Mode 2 except the output remains low for half of the timer period and high for the other half of the period.
• Mode 4: Software Triggered Pulse.
The output will remain high untill the timer has counted to zero, at which point the output will pulse low and then go high again.
• Mode 5: Hardware Triggered Pulse.
The counter will start counting once the gate input goes high, when the counter reaches zero the
output will pulse low and then go high again.
If 6 is loaded in the counter then it will start count down from 60. After reaching 0, change the OUT signal like from LoHi. • First 2 MSBs select the counter. Addresses for 3 counters in flight board’s 8253 are:
Register Activity Allowed Port Address
Counter 0 Read/Write 08H Counter 1 Read/Write 0AH Counter 2 Read/Write 0CH Control Word Write Only 0EH
8259 PIC
The 8259 Programmable Interrupt Controller (PIC) is one of the most important chips making up the x86 architecture. Without it, the x86 architecture would not be an interrupt driven architecture. The function of the 8259A is to manage hardware interrupts and send them to the appropriate system interrupt. This allows the system to respond to devices needs without loss of time (from polling the device, for instance).
It is important to note that APIC has replaced the 8259 PIC in more modern systems, especially those with multiple cores/processors. The 8259 PIC controls the CPU's interrupt mechanism, by accepting several interrupt requests and feeding them to the processor in order. For instance, when a keyboard registers a keyhit, it sends a pulse along it's interrupt line (IRQ1) to the
PIC chip, which then translates the IRQ into a system interrupt, and sends a message to interrupt the CPU from whatever it is doing. Part of the kernel's job is to either handle these IRQs and perform the necessary procedures (poll the keyboard for the scancode) or alert a userspace program to the interrupt (send a message to the keyboard driver).
Without a PIC, you would have to poll all the devices in the system to see if they want to do anything (signal an event), but with a PIC, your system can run along nicely until such time that a device wants to signal an event, which means you don't waste time going to the devices, you let the devices come to you when they are ready.
VIVA QUESTION:
1. What is micro processor?
2. State different parts of 8086.
3. State the modes 8255.
4. What are modes of 8253?
MARK ALLOCATION
RESULT:
Thus the 8086 Architecture, 8255 – PPI, 8253 – PIT, 8279 – PKI and 8259 – PIC has been studied.
CONTINUOUS INTERNAL ASSESSMENT Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE: FACTORIAL OF A GIVEN HEXA DECIMAL NUMBER
AIM:
To write an assembly language program to calculate factorial of a given numbers.
ALGORITHM:
1. Start the program.
2. Move immediately the number 0000H to AX register. 3. Copy the contents of the memory 3000 to CX register. 4. Move immediately the number 0001H to AX register.
5. Multiply the content of the CX register with the content of accumulator. 6. Decrement the content of CX register once.
7. Jump to specified memory location if there is no zero in CX register. 8. Copy the content to AX register to two memories from 2000.
9. End
PROGRAM:
PROGRAM COMMENTS
MOV AX, 0001 Move immediately the number 0001H to AX register
MOV CX, [3000] Copy the contents of memory 3000 to CX register
MOV AX, 0001 Move immediately the number 0000H to AX register
Loop1 :MUL CX Multiply content of CX register with content of accumulator
DEC CX Decrement content of CX register once
JNZ loop1 Jump to specified memory location if there is no zero in CX register
MOV [2000], AX Copy content to AX register to memory 2000
OUTPUT:
VIVA QUESTIONS:
1. Mention the general purpose registers in 8085 microprocessor.
2. What is the function of accumulator?
3. What is buffer?
4. What is Opcode?
MARK ALLOCATION:
RESULT:
Thus the program for performing factorial of a given numbers is executed and verified. CONTINUOUS INTERNAL ASSESSMENT
Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE: 16 BIT ARITHMETIC OPERATION AIM:
To write an assembly language program for doing arithmetic operations like addition, subtraction, multiplication and division operation of two numbers.
ALGORITHM: (i) 16-bit addition
1. Initialize the MSBs of sum to 0 2. Get the first number.
3. Add the second number to the first number.
4. If there is any carry, increment MSBs of sum by 1. 5. Store LSBs of sum.
6. Store MSBs of sum.
(ii) 16-bit subtraction
1. Initialize the MSBs of difference to 0 2. Get the first number
3. Subtract the second number from the first number.
4. If there is any borrow, increment MSBs of difference by 1. 5. Store LSBs of difference
6. Store MSBs of difference.
(iii) 16-bit addition multiplication
1. Get the multiplier. 2. Get the multiplicand 3. Initialize the product to 0.
4. Product = product + multiplicand 5. Decrement the multiplier by 1
6. If multiplicand is not equal to 0, repeat from step (d) otherwise store the product.
(iv) 16-bit addition division
1. Get the dividend 2. Get the divisor
3. Initialize the quotient to 0. 4. Dividend = dividend –divisor
5. If the divisor is greater, store the quotient. Go to step g.
6. If dividend is greater, quotient = quotient + 1. Repeat from step (d) 7. Store the dividend value as remainder.
PROGRAM 1. Addition:
PROGRAM COMMENTS
MOV CX, 0000H Initialize counter CX MOV AX,[1200] Get the first data in AX reg MOV BX, [1202] Get the second data in BX reg
ADD AX,BX Add the contents of both the regs AX & BX JNC L1 Check for carry
INC CX If carry exists, increment the CX L1 : MOV [1206],CX Store the carry
MOV [1204], AX Store the sum
HLT Stop the program
2. Subtraction:
PROGRAM COMMENTS
MOV CX, 0000H Initialize counter CX MOV AX,[1200] Get the first data in AX reg MOV BX, [1202] Get the second data in BX reg
SUB AX,BX Subtract the contents of BX from AX JNC L1 Check for borrow
INC CX If borrow exists, increment the CX L1 : MOV [1206],CX Store the borrow
MOV [1204], AX Store the difference
3. Multiplication:
PROGRAM COMMENTS
MOV AX,[1200] Get the first data MOV BX, [1202] Get the second data
MUL BX Multiply both
MOV [1206],AX Store the lower order product
MOV AX,DX Copy the higher order product to AX MOV [1208],AX Store the higher order product
HLT Stop the program
4. Division:
PROGRAM COMMENTS
MOV AX,[1200] Get the first data MOV DX, [1202] Get the second data
MOV BX, [1204] Divide the dividend by divisor DIV BX Store the lower order product
MOV [1206],AX Copy the higher order product to AX MOV AX,DX Store the higher order product MOV [1208],AX Stop the program
OUTPUT:
VIVA QUESTION:
1. What are the operations can be performed by logical operators?
2. Compare subtract and compare instructions.
3. What is the data and address size in 8086?
4. What is the difference between instructions DIV & IDIV?.
MARK ALLOCATION:
RESULT:
Thus the program for 16 bit arithmetic operation is executed and verified. CONTINUOUS INTERNAL ASSESSMENT
Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE:
SUM OF ‘N’ NATURAL NUMBERS
AIM:
To write an assembly language program for performing the sum of ‘N’ natural numbers.
ALGORITHM:
1. Get ‘N’ natural numbers as input. 2. Initialize the contents.
3. Increment register & decrement the count. 4. Set memory address for destination.
5. Move content values to destination location as total sum. 6. Store the total sum.
PROGRAM:
PROGRAM COMMENTS
MOV SI, 2000 Set source index as 2000
MOV CL, [SI] Move content of address pointed by source index to CL MOV AL, 00 Clear AL to store sum
MOV BL, 01 Move '1' to BL , as it’s the first number LOOP:ADD AL, BL Add content of BL to AL
INC BL increment BL
DEC CL Decrement the count JNZ LOOP Jump if not zero to Loop
MOV DI, 2002 Set Destination index as memory address 2002
MOV [DI], AX Move content of Register A to destination, which is the total sum HLT Stop the program
OUTPUT:
VIVA QUESTION:
1. What are the modes in which 8086 can operate?
2. List the instructions of 8086 that affects only carry flag.
3. What is the difference between jump and call instructions?
4. List the I/O instructions of 8086.
MARK ALLOCATION:
RESULT:
Thus the program for performing the sum of ‘N’ natural numbers is executed and verified.
CONTINUOUS INTERNAL ASSESSMENT Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE:
CONVERSION OF HEXADECIMAL TO BINARY
AIM:
To write an assembly language program to convert hexadecimal to binary.
ALGORITHM:
1. Load AL with the input data.
2. Check If (AL<=9) then add 30 with AL register. 3. Else add 7 with AL register.
4. Result stored into AL register
PROGRAM:
PROGRAM COMMENT
MOV AL,0A LOAD REGISTER AL WITH THE DATA 10
CMP AL,09 IF DATA LESS THAN 9 ADD 30 TO THE DATA JZ 110A IF COUNT IS ZERO THEN GO TO 110A
JB 110A IF 1
st
OPERAND IS BELOW THAN 2
nd
OPERAND THEN SHORT JUMP INTO 110A
ADD AL,07 ELSE ADD AL WITH 07 ADD AL,30 ADD 30 WITH AL
OUTPUT:
VIVA QUESTION:
1. What is meant by interrupt?
2. What is the use of ready pin?
3. State the machine control instructions.
4. What are the flags in 8086?
MARK ALLOCATION
RESULT:
Thus the program for conversion of hexadecimal to binary (ASCII value) is executed and verified.
CONTINUOUS INTERNAL ASSESSMENT Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE: CONVERSION OF BINARY TO HEXADECIMAL
AIM:
To write an assembly language program to convert binary to hexadecimal.
ALGORITHM:
1. Load the input data in AL register. 2. Subtract 30 from AL register value.
3. If data is less than or equal to 16 terminate the program. 4. Else subtract 7 from AL register value.
5. Result stored in AL register
PROGRAM:
PROGRAM COMMENTS
MOV AL,31 Get data 31 into AL SUB AL,30 Subtract 30 with the AL
CMP AL,10 If data is less than or equal to 16 go to 110C
JB 110C If 1st operand is below the 2nd operand then short jump into 110C JZ 110C If count zero then jump into to 110C
SUB AL,07 Else subtract 7 from AL register value HLT Break point
OUTPUT:
VIVA QUESTION:
1. What is register addressing?
2. What is Program counter?
3. What is meant by Maskable interrupts?
4. What is Logical Address?
MARK ALLOCATION:
RESULT:
Thus the program for conversion of binary (Represented in ASCII value) to hexadecimal is executed and verified.
CONTINUOUS INTERNAL ASSESSMENT Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE: ASCENDING AND DESCENDING ORDER
AIM:
To write an Assembly Language Program to sort a given array in ascending and descending order.
ALGORITHM:
(i) Sorting in ascending order:
1. Load the array count in two registers C1and C2.
2. Get the first two numbers.
3. Compare the numbers and exchange if necessary so that the two numbers are in ascending order.
4. Decrement C2.
5. Get the third number from the array and repeat the process until C2is 0.
6. Decrement C1and repeat the process until C1is 0.
(ii) Sorting in descending order:
1. Load the array count in two registers C1and C2.
2. Get the first two numbers.
3. Compare the numbers and exchange if necessary so that the two numbers are in descending order.
4. Decrement C2.
5. Get the third number from the array and repeat the process until C2is 0.
6. Decrement C1and repeat the process until C1is 0.
PROGRAM: 1. ASCENDING
PROGRAM COMMENTS
MOV SI,1200H Initialize memory location for array size MOV CL,[SI] Number of comparisons in CL
L4 : MOV SI,1200H Initialize memory location for array size MOV DL,[SI] Get the count in DL
INC SI Go to next memory location MOV AL,[SI] Get the first data in AL L3 : INC SI Go to next memory location MOV BL,[SI] Get the second data in BL CMP AL,BL Compare two data’s JNB L1 If AL < BL go to L1
DEC SI Else, Decrement the memory location MOV [SI],AL Store the smallest data
MOV AL,BL Get the next data AL JMP L2 Jump to L2
L1 : DEC SI Decrement the memory location
MOV [SI],BL Store the greatest data in memory location L2 : INC SI Go to next memory location
DEC DL Decrement the count
JNZ L3 Jump to L3, if the count is not reached zero MOV [SI],AL Store data in memory location
DEC CL Decrement the count
JNZ L4 Jump to L4, if the count is not reached zero
HLT Stop
2. DESCENDING
PROGRAM COMMENTS
MOV SI,1200H Initialize memory location for array size MOV CL,[SI] Number of comparisons in CL
L4 : MOV SI,1200H Initialize memory location for array size MOV DL,[SI] Get the count in DL
INC SI Go to next memory location MOV AL,[SI] Get the first data in AL L3 : INC SI Go to next memory location MOV BL,[SI] Get the second data in BL CMP AL,BL Compare two data’s JB L1 If AL > BL go to L1
DEC SI Else, Decrement the memory location MOV [SI],AL Store the largest data
MOV AL,BL Get the next data AL JMP L2 Jump to L2
L1 : DEC SI Decrement the memory location
MOV [SI],BL Store the smallest data in memory location L2 : INC SI Go to next memory location
DEC DL Decrement the count
JNZ L3 Jump to L3, if the count is not reached zero MOV [SI],AL Store data in memory location
DEC CL Decrement the count
JNZ L4 Jump to L4, if the count is not reached zero
OUTPUT:
VIVA QUESTION:
1. From which address the 8086 starts execution after reset?
2. What are the modes in which 8086 can operate?
3. What is the data and address size in 8086?
4. What is purpose served by CX register?
MARK ALLOCATION:
RESULT:
Thus the program for sorting a given array in ascending and descending order is executed and verified.
CONTINUOUS INTERNAL ASSESSMENT Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.: DATE:
MOVING DATA FROM SOURCE LOCATION TO DESTINATION LOACTION
AIM:
To write an Assembly Language Program to moving data from source location to destination location (1200H-1205H to 2200H – 2205H).
ALGORITHM:
1. Move the count value in the source index register.
2. Move the count value to CL register.
3. Increment source index register.
4. Move the contents of source index to AL.
5. Move the contents of AL to destination index.
6. Increment the destination index.
7. Increment the source index.
8. Decrement the contents of CL register
9. If no zero jump to the loop.
10. Stop the program.
PROGRAM:
PROGRAM COMMENTS
LEA SI,[2000] Move the count value in the source index register. LEA DI,[2200] Move the count value to CL register.
MOV CL,[CL] Move contents
INC SI Increment source index register.
L1:MOV AL,[SI] Move the contents of source index to AL. MOV [DI],AL Move the contents of AL to destination index. INC DI Increment the destination index.
INC SI Increment the source index.
DEC CL Decrement the contents of CL register JNZ L1 If no zero jump to the loop.
OUTPUT:
VIVA QUESTION:
1. What are data copy/transfer instructions?
2. Define index register.
3. Differentiate near and far jump.
4. Define software interrupt.
MARK ALLOCATION:
RESULT:
Thus the program for moving data from source location to destination location is executed and verified.
CONTINUOUS INTERNAL ASSESSMENT Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE: REVERSING THE STRING
AIM:
To write an Assembly Language Program for reversing the given string.
ALGORITHM:
1. AX is initialized with data & AX is moved into DS
2. Initialize CX to 5
3. Load the effective address in SI & DI. Add SI with 04
4. Move SI to AL
5. Decrement SI & Increment DI. Repeat this until an interrupt is raised
6. Stop the Process.
PROGRAM:
PROGRAM COMMENTS
MOV SI,2000
Move value of address 2000 to source indexMOV DI,2008
Move value of address 2008 to destinationindex
MOV CX,0008
Move 0008 to CXADD SI,07
ADD SI AND 07UP:MOV AL,[SI]
Move value of SI to ALMOV [DI],AL
Move AL to the destination addressDEC SI
Decrement SIINC DI
Increment DIDEC CX
Decrement CXJNZ UP
JumpOUTPUT
VIVA QUESTION:
1. Differentiate “shift” and “rotate”?
2. List the string manipulation commands.
3. What is the use of direction flag?
4. Difference between Microprocessor & Microcontroller
MARK ALLOCATION:
RESULT:
Thus the program for reversing the string is executed and verified CONTINUOUS INTERNAL ASSESSMENT
Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE: GENERATING THE SERIES
AIM:
To write an Assembly Language Program for generating the series. .
ALGORITHM:
OUTPUT:
VIVA QUESTION:
1. What is the purpose of BIU?
2. What is the purpose of EU?
3. What is the purpose of segment register?
4. What are the segments registers in 8086?
MARK ALLOCATION:
RESULT:
Thus the program for generating the series is executed and verified. CONTINUOUS INTERNAL ASSESSMENT Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE: GENERATING SQUARE WAVE USING 8255 PPI AIM:
To write an Assembly Language Program for generating square wave using 8255 PPI.
ALGORITHM:
1. Initialize channel 0 in mode 3 2. Initialize the LSB of the count. 3. Initialize the MSB of the count. 4. Trigger the count
5. Read the corresponding output in CRO.
PROGRAM:
MODES 3 – SQUARE WAVE GENERATOR:
PROGRAM COMMENTS
MOV AL, 36H Store the control word in accumulator OUT 0BH Send through output port
MOV AL, 0AH Copy lower order count value in accumulator OUT 08H Send through output port
MOV AL, 00H Copy higher order count value in accumulator OUT 08H Send through output port
OUTPUT:
VIVA QUESTION:
1. Write any two processor control instructions.
2. Mention any four initialization list in the 8086 program.
3. What are the assembly language program development tools?
4. What is an assembler directive?
MARK ALLOCATION:
RESULT:
Thus the program for generating the square wave is executed and verified. CONTINUOUS INTERNAL ASSESSMENT
Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE: GENERATING RATE GENERATOR USING 8253 PIT
AIM:
To write an assembly language program for generating rate generator using 8253 PIT.
ALGORITHM
1. Initialize channel 0 in mode 2 2. Initialize the LSB of the count. 3. Initialize the MSB of the count. 4. Trigger the count
5. Read the corresponding output in CRO.
PROGRAM:
MODE 2 – RATE GENERATOR:
PROGRAM COMMENTS
MOV AL, 34H Store the control word in accumulator OUT 0BH Send through output port
MOV AL, 0AH Copy lower order count value in accumulator OUT 08H Send through output port
MOV AL, 00H Copy higher order count value in accumulator OUT 08H Send through output port
OUTPUT:
VIVA QUESTION:
1. What is minimum mode?
2. What is maximum mode?
3. What is machine cycle?
4. What is instructions cycle?
MARK ALLOCATION:
RESULT:
Thus the program for generating the rate generator is executed and verified. CONTINUOUS INTERNAL ASSESSMENT
Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.:
DATE: INTERFACE KEYBOARD WITH 8086 USING 8279 PKI AIM:
To write an assembly language program for interfacing keyboard with 8086 using 8279 PKI.
ALGORITHM:
1. Initialize the counter
2. Set 8279 for 8 digit character display, right entry 3. Set 8279 for clearing the display
4. Write the command to display
5. Load the character into accumulator and display it 6. Introduce the delay
7. Repeat from step 1
PROGRAM:
PROGRAM COMMENTS
START : MOV SI,1200H Initialize array MOV CX,000FH Initialize array size
MOV AL,10 Store the control word for display mode OUT C2,AL Send through output port
MOV AL,CC Store the control word to clear display OUT C2,AL Send through output port
MOV AL,90 Store the control word to write display OUT C2,AL Send through output port
L1 : MOV AL,[SI] Get the first data
OUT C0,AL Send through output port CALL DELAY Give delay
INC SI Go & get next data
LOOP L1 Loop until all the data’s have been taken JMP START Go to starting location
DELAY : MOV DX,0A0FFH Store 16bit count value LOOP1 : DEC DX Decrement count value
JNZ LOOP1 Loop until count values becomes zero RET Return to main program
OUTPUT:
VIVA QUESTION:
1. List the functions performed by 8279.
2. What are the different types of ADC?
3. What is baud rate?
4. What are the different scan modes of 8259?
MARK ALLOCATION:
RESULT:
Thus the program for interface keyboard with 8086 using 8279 PKI is executed and verified CONTINUOUS INTERNAL ASSESSMENT
Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM:
Ex.No.: DATE:
INTERFACE ANALOG TO DIGITAL CONVERTER
AIM:
To write an assembly language program for interfacing analog to digital converter.
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 (iii) 5. Read the digital output.
6. Store it in a memory location
PROGRAM:
PROGRAM COMMENTS
MOV AL,00 LOAD ACCUMULATOR WITH VALUE FOR ALE HIGH OUT 0C8H,AL SEND THROUGH OUTPUT PORT
MOV AL,08 LOAD ACCUMULATOR WITH VALUE FOR ALE LOW OUT 0C8H,AL SEND THROUGH OUTPUT PORT
MOV AL,01 STORE THE VALUE TO MAKE SOC HIGH IN THE ACCUMULATOR OUT 0D0H,AL SEND THROUGH OUTPUT PORT
MOV AL,00
INTRODUCE DELAY MOV AL,00
MOV AL,00
MOV AL,00 STORE THE VALUE TO MAKE SOC LOW THE ACCUMULATOR OUT 0D0H,AL SEND THROUGH OUTPUT PORT
AND AL,01 READ THE EOC SIGNAL FROM PORT & CHECK FOR END OF CONVERSION
CMP AL,01
JNZ L1 IF THE CONVERSION IS NOT YET COMPLETED, READ EOC SIGNAL FROM PORT AGAIN
IN AL,0C0H READ DATA FROM PORT
MOV BX,1100 INITIALIZE THE MEMORY LOCATION TO STORE DATA MOV [BX],AL STORE THE DATA
HLT STOP
VIVA QUESTIONS:
1. What is port?
2. Give some port devices used in 8086. 3. State some features of 8259.
4. What is exception?
5. State Intel predefined interrupt.
MARK ALLOCATION:
RESULT:
Thus the program for interfacing analog to digital converter is executed and verified. CONTINUOUS INTERNAL ASSESSMENT
Preparation &
conduct of experiment 50 Observation & result 30
Record 10
Viva voce 10
ADDITIONAL PROGRAM: