New MP Manual
New MP Manual
New MP Manual
operations using 8086 microprocessor kit. Apparatus required: 1. 8086 Microprocessor kit 2. Keyboard and power supply Algorithm: ADDITION: 1. Move the 16 bit data directly to the AX register(AX1234(1st data)) 2. Move the 16 bit data immediately to the BX register (BX5678(2nd data)) 3. Clear the DX register to Store the Carry (DX0000) 4. Add the AX register content and BX register content. The sum value is stored in the AX register(AX+BXAX) 5. Check for carry if carry arises increment the carry register(DX) 6. If no carry define the destination index as 2300(STA 40F3put Address) 7. Then move the sum value present in the AX register to the destination index(AX2300) 8. Increment the destination index twice to attain the next address(2302) 9. Move the carry value present in the DX register to the present DI address(DX2302) 10. Stop the execution. SUBTRACTION: 1. Move the 16 bit data directly to the AX register(AX5678 (1st data)) 2. Move the 16 bit data immediately to the BX register (BX1234(2nd data)) 3. Clear the DX register to Store the borrow (DX0000) 4. Subtract the AX register content and BX register content. The sum value is stored in the AX register(AX-BXAX) 5. Check for carry if carry arises increment the carry register(DX) 6. If no carry define the destination index as 2300(STA 40F3put Address) 7. Then move the difference value present in the AX register to the destination index(AX2300) 8. Increment the destination index twice to attain the next address(2302)
9. Move the borrow value present in the DX register to the present DI address(DX2302) 10. Stop the execution. MULTIPLICATION: 1. Define the Source index as 2200(SI2200(Input address)) 2. Define the destination index as 2300(DI2300(STA 40F3put address)) 3. Clear the DX register to store the carry value. 4. Move the source index content(1st data) to AX register(SI(2200)AX) 5. Increment the source index twice to Access the next data(INC SI) 6. Now move the SI content(2nd data) to BX register(SI(2202)BX) 7. Multiply the AX content and BX content by using IMUL instruction(AX*BXAX,DX) 8. AX product value 9. DXCarry value 10. Move the AX register content(product) to the Destination index(2300)(AX2300) 11. Increment the DI twice to obtain the Next address location(2302) 12. Move the DX register(carry) content to the DI(DX2302(DI)) 13. Stop the execution. DIVISION: 1. Define the Source index as 2200(SI2200(Input address)) 2. Define the destination index as 2300(DI2300(STA 40F3put address)) 3. Clear the DX register to store the carry value. 4. Move the source index content(1st data) to AX register(SI(2200)AX) 5. Increment the source index twice to Access the next data(INC SI) 6. Now move the SI content(2nd data) to BX register(SI(2202)BX) 7. Multiply the AX content and BX content by using IMUL instruction(AX/BXAX,DX) 8. AX Quotient value 9. DXReminder value 10. Move the AX register content(Quotient) to the Destination index(2300)(AX2300)
11. Increment the DI twice to obtain the Next address location(2302) 12. Move the DX register(Reminder) content to the DI(DX2302(DI)) 13. Stop the execution ADDITION ADDRESS LABEL MNEMONICS 2000 MOV AX,1234 2003 MOV BX,5678 2006 MOV DX,0000 2009 ADD AX,BX 200B JNC L1 200D INC DX 200E L1 MOV DI,2300 2011 MOV [DI],AX 2013 INC DI 2014 INC DI 2015 MOV [DI],DX 2017 INT 03 SUBTRACTION ADDRESS LABEL 2000 2003 2006 2009 200B 200D 200E L1 2011 2013 2014 2015 2017 COMMENTS Move the data 1234 to AX Move the data 5678 to BX Move the data 0000 to DX Add AX and BX register Jump if no carry to loop1 Increment DX register Move the data in 2300 to DI Move the AX reg to DI reg Increment DI reg Increment DI reg Move the DX to DI reg Stop the program
MNEMONICS MOV AX,5678 MOV BX,1234 MOV DX,0000 SUB AX,BX JNC L1 INC DX MOV DI,2300 MOV [DI],AX INC DI INC DI MOV [DI],DX INT 03
COMMENTS Move the data 5678 to AX Move the data 1234 to BX Move the data 0000 to DX subtract AX and BX register Jump if no carry to loop1 Increment DX register Move the data in 2300 to DI Move the AX reg to DI reg Increment DI reg Increment DI reg Move the DX to DI reg Stop the program
MULTIPLICATION ADDRESS LABEL 2000 2003 2006 2009 200B 200C 200D
MNEMONICS MOV SI,2200 MOV DI,2300 MOV DX,0000 MOV AX,(SI) INC SI INC SI MOV BX,(SI)
COMMENTS Move 2200 to SI reg Move 2300 to DI reg Move 0000 to DX reg Move (SI) to AX reg Increment SI by 1 Increment SI by 1 Move (SI) to BX reg
Multiply BX with accumulator Move AX to DI reg Increment DI by 1 Increment DI by 1 Move DX to DI reg End of the program
DIVISION ADDRESS LABEL MNEMONIC 2000 MOV SI,2200 2003 MOV DI,2300 2006 MOV DX,0000 2009 MOV AX,(SI) 200B INC SI 200C INC SI 200D MOV BL,(SI) 200F IDIV BL 2010 MOV (DI),AX 2013 INC DI 2014 INC DI 2015 MOV (DI),DX 2017 INT 03 Addition: Input Address Data
COMMENTS Move 2200 to SI reg Move 2300 to DI reg Move 0000 to DX reg Move (SI) to AX reg Increment SI by 1 Increment SI by 1 Move (SI) to BL reg Divide accumulator with BL Move AX to DI reg Increment DI by 1 Increment DI by 1 Move DX to DI reg End of the program
RESULT: Thus the ALP that Performs the Arithmetic operations using 8086 was written ,verified and executed successfully.
8.PROGRAM FOR SORTING USING 8086 AIM: To write a program to perform a sorting (ascending and descending ) using 8086 Apparatus required: 1. 8086 microprocessor kit 2. Powersupply and keyboard Algorithm: 1. Start the program 2. Get the count value in CL 3. Set the SI to 2200 4. Get the count value in CH (No of individual comparisons) 5. Get the data to AX from SI 6. Increment the SI twice to get the next address 7. Get the data to BX from SI 8. Compare AX and BX values 9. Check for carry If carry arises decrement the CH value 10. If no carry arises move the AX content to SI 11. Decrement the SI value twice to get the previous address 12. Move the BX content to the SI 13. Increment the SI twice 14. Decrement the CH value 15. Check if CH=0 or not 16. If CH not equal to zero Move the SI content to AX and repeat the comparison process as said earlier until the CH becomes zero 17. If CH=0 Decrement the CL value 18. Check CL=0 or not 19. If CL not equal to zero repeat the process from earlier (Set the SI to 2200)
20. If CL=0 stop the execution. DESCENDING ORDER 21. Start the program 22. Get the count value in CL 23. Set the SI to 2200 24. Get the count value in CH (No of individual comparisons) 25. Get the data to AX from SI 26. Increment the SI twice to get the next address 27. Get the data to BX from SI 28. Compare AX and BX values 29. Check for carry If carry arises decrement the CH value 30. If no carry arises move the AX content to SI 31. Decrement the SI value twice to get the previous address 32. Move the BX content to the SI 33. Increment the SI twice 34. Decrement the CH value 35. Check if CH=0 or not 36. If CH not equal to zero Move the SI content to AX and repeat the comparison process as said earlier until the CH becomes zero 37. If CH=0 Decrement the CL value 38. Check CL=0 or not 39. If CL not equal to zero repeat the process from earlier (Set the SI to 2200) 40. If CL=0 stop the execution. ASCENDING ORDER: ADDRESS LABEL MNEMONICS 2000 MOV CL,04 2002 L3 MOV SI,2200 2005 MOV CH,04 2007 L2 MOV AX,(SI) COMMENTS Move the content of data to CL Move the content of address to source index Move the data 04 to CH Move the content of source index to accumulator
2009 INC SI 200A INC SI 200B MOV BX,(SI) 200D CMP AX,BX 200F JC L1 2011 MOV (SI),AX 2013 DEC SI 2014 DEC SI 2015 MOV (SI),BX 2017 INC SI 2018 INC SI 2019 L1 DEC CH 201B JNZ L2 201D DEC CL 201E JNZ L3 2021 INT 03 DESCENDING ORDER ADDRESS LABEL MNEMONICS 2000 MOV CL,04 2002 L3 MOV SI,2200 2005 MOV CH,04 2007 L2 MOV AX,(SI) 2009 INC SI 200A INC SI 200B MOV BX,(SI) 200D CMP AX,BX 200F JNC L1 2011 MOV (SI),AX 2013 DEC SI 2014 DEC SI 2015 MOV (SI),BX 2017 INC SI 2018 INC SI 2019 L1 DEC CH 201B JNZ L2 201D DEC CL 201E JNZ L3 2021 INT 03
Increment source index Increment source index Move the content of SI to B reg Compare accumulator with B register If carry is set jump to loop1 Move the content of accumulator to source index Decrement source index Decrement source index Move the content of B reg to SI Increment source index Increment source index Decrement CH Jump if no zero to loop2 Decrement CL Jump if no zero to loop3 End of the program COMMENTS Move the content of data to CL Move the content of address to source index Move the data 04 to CH Move the content of source index to accumulator Increment source index Increment source index Move the content of SI to B reg Compare accumulator with B register If carry is not set jump to loop1 Move the content of accumulator to source index Decrement source index Decrement source index Move the content of B reg to SI Increment source index Increment source index Decrement CH Jump if no zero to loop2 Decrement CL Jump if no zero to loop3 End of the program
Result: Thus the program for sorting (ascending and descending order) was executed and verified successfully.
9.PROGRAM FOR SEARCHING USING 8086 Aim: To write a program to perform a searching (largest and smallest number) using 8086 Apparatus required: 1. 8086 microprocessor kit 2. Power supply and keyboard Algorithm: LARGEST NUMBER: 1. Start the program 2. Set SI to 2200 3. Set DI to 2300 4. Get the count value in CL(No of inputs) 5. Get the data to AX from SI 6. Decrement the Count value(CLCL-01) 7. Increment the SI twice to get the next address 8. Get the data to BX from SI 9. Compare AX and BX value 10. If carry arises move the BX value to AX and decrement the CL 11. If no carry decrement the CL 12. Check if CL=0 or not 13. If CL not equal to zero Increment the SI twice to obtain the next value 14. The value is moved to BX and the comparison operation is repeated until CL=0 15. If CL=0 move the AX(Largest number) content to DI 16. Stop the execution SMALLEST NUMBER: 17. Start the program 18. Set SI to 2200 19. Set DI to 2300 20. Get the count value in CL(No of inputs)
21. Get the data to AX from SI 22. Decrement the Count value(CLCL-01) 23. Increment the SI twice to get the next address 24. Get the data to BX from SI 25. Compare AX and BX value 26. If carry arises move the BX value to AX and decrement the CL 27. If no carry decrement the CL 28. Check if CL=0 or not 29. If CL not equal to zero Increment the SI twice to obtain the next value 30. The value is moved to BX and the comparison operation is repeated until CL=0 31. If CL=0 move the AX(Largest number) content to DI 32. Stop the execution LARGEST NUMBER: ADDRESS LABEL MNEMONICS 2000 MOV SI,2200 2003 MOV DI,2300 2006 MOV CL,05 2008 MOV AX,(SI) 200A DEC CL 200C L1 INC SI 200D INC SI 200E MOV BX,(SI) 2010 CMP AX,BX 2012 JNC L1 2014 MOV AX,BX 2016 L1 DEC CL 2018 JNZ L2 201A MOV (DI),AX 201C INT 03 SMALLEST NUMBER: ADDRESS LABEL MNEMONICS 2000 MOV SI,2200 2003 MOV DI,2300 2006 MOV CL,05 2008 MOV AX,(SI) 200A DEC CL 200C INC SI COMMENTS Move the content of address to source index Move the address to destination index Move the content of data to CL Move the content of SI to accumulator Decrement the CL value Increment the source index Increment the source index Move the source index content to SI Compare accumulator with B reg Jump if no carry then go to loop1 Move the content of B reg to accumulator Decrement CL value Jump if no zero then go to loop2 Move the content of accumulator to DI End of the program COMMENTS Move the content of address to source index Move the address to destination index Move the content of data to CL Move the content of SI to accumulator Decrement the CL value Increment the source index
200D 200E L2 2010 2012 2014 2016 L1 2018 201A 201C Largest: Input Address Data
INC SI MOV BX,(SI) CMP AX,BX JC L1 MOV AX,BX DEC CL JNZ L2 MOV (DI),AX INT 03 STA 40F3put Address Data
Increment the source index Move the source index content to SI Compare accumulator with B reg Jump if carry is set then go to loop1 Move the content of B reg to accumulator Decrement CL value Jump if no zero then go to loop2 Move the content of accumulator to DI End of the program
Result: Thus the program of searching (largest and smallest number) was executed and verified.
10.PROGRAM FOR STRING MANIPULATION Aim: To write a program to perform string manipulation (moving a block of data and find& replace the data) using 8086. Apparatus required: 1. 8086 microprocessor kit 2. Powersupply 3. Keyboard Algorithm: Moving a block of data: 1. Define source index as 2200(I/P address) 2. Define Destination index as 2300 (O/P address) 3. Get the count value in CL register (No of inputs) 4. Move the source index data to AX register(SI(2200)AX) 5. Move the AX register content to the Destination index (AXDI(2300)) 6. Increment the Destination index twice to attain the next address(2302) 7. Increment the source index twice to attain the next address(2202) 8. Decrement the CL register value by one (CL=CL-1) 9. Check whether the Value in CL register is zero or not 10. If zero flag in set terminate the loop 11. If zero flag is not set repeat the transformation(SIAX & AXDI) of data until CL=00 12. If CL=00 Stop the program. Find and replace the data: 1. Move the data to be replaced in DX register 2. Define source index address as 2200 3. Define destination index address as 2300 4. Get the count value in CL register (No of inputs) 5. Move 0003 to BX register (Data to be find) 6. Move the data present in the source index to AX register 7. Compare AX & BX register
8. If the zero flag is set interchange the AX register content with DX register content 9. Otherwise move the AX register value to the Destination index 10. Increment the source index twice to attain the next address (2202) 11. Increment the Destination index twice to attain the next address (2302) 12. Decrement the count value.(CL=CL-1) 13. Check if CL=00 or not. If CL=00 terminate the loop. 14. Otherwise repeat the comparison and replace process until the CL reg value becomes Zero. 15. If CL=00 stop the program. MOVING A BLOCK OF DATA: ADDRESS LABEL MNEMONICS 2000 MOV SI,2200 2003 MOV DI,2300 2006 MOV CL,05 2008 L1 MOV AX,(SI) 200A MOV (DI),AX 200C INC DI 200D INC DI 200E INC SI 200F INC SI 2010 DEC CL 2012 JNZ L1 2014 INT 03 FIND AND REPLACE THE DATA: ADDRESS LABEL MNEMONICS 2000 MOV DX,0007 2003 MOV SI,2200 2006 MOV DI,2300 2009 MOV CL,04 200B MOV BX,0003 200E L2 MOV AX,(SI) 2010 CMP AX,BX 2012 JNZ L1 2014 MOV AX,DX 2016 L1 MOV (DI),AX 2018 INC SI 2019 INC SI 201A INC DI 201B INC DI COMMENTS Move the content of address to source index Move the data to destination index Move the content of data to CL Move the SI register in accumulator Move the accumulator to DI Increment the destination index Increment the destination index Increment the source index Increment the source index Decrement the CL value Jump if no zero go to loop1 End the program
COMMENTS Move the content of data to D register Move the content of data to source index Move the content of data to destination index Move the content of data to CL Move the content of data to B reg Move the source index to accumulator Compare accumulator with B reg Jump if no zero then go to loop1 Move the content of D reg to accumulator Move the accumulator to destination index Increment source index Increment source index Increment destination index Increment destination index
Decrement the CL value Jump if no zero then go to loop2 Stop the program
Moving a block of data: Input STA 40F3put Address Data Address Data
Find and replace the data: Input STA 40F3put Address Data Address Data
Result: Thus the program of string manipulation (moving a block of data and find & replace the data) was executed and verified successfully.
11.PROGRAMMING WITH 8051 ARITHMETIC OPERATIONS AIM: To write an ALP that perform arithmetic operations using 8051. APPARATUS REQUIRED: 1. 8051 Micro Controller kit 2. Power supply and Keyboard ALGORITHM: ADDITION: 1. Initialize the register R0 (carry register) 2. Set DataPointer(DPTR) as 8300 (STA 40F3put address) 3. Move first data to the register R1 4. Move the content in R1 to A register 5. Move the 2nd data to the register R2 6. Add the A reg content and R2 reg content (AA+R2) 7. Check if carry is present or not 8. If carry is present increment the carry register(R0) 9. Other wise move the content of A register(Sum) to the DPTR(8300) 10. Move the carry register(R0) content to A register 11. Increment the DPTR (DPTR=8301) 12. Move the content of A register to DPTR(carry8301) 13. Stop the execution SUBTRACTION: 14. Initialize the register R0 (borrow register) 15. Set DataPointer(DPTR) as 8300 (STA 40F3put address) 16. Move first data to the register R1 17. Move the content in R1 to A register 18. Move the 2nd data to the register R2 19. Subtract the R2 reg content from A reg content (AA-R2) 20. Check if carry is present or not 21. If carry is present increment the carry register(R0) 22. Other wise move the content of A register(Sum) to the DPTR(8300) 23. Move the borrow register(R0) content to A register 24. Increment the DPTR (DPTR=8301) 25. Move the content of A register to DPTR(borrow8301) 26. Stop the execution MULTIPLICATION: 26. Initialize the register R0 (carry register) 27. Set DataPointer (DPTR) as 8300 (STA 40F3put address) 28. Move first data to the register R1 29. Move the content in R1 to A register 30. Move the 2nd data to the register R2 31. Move R2 register content to F0(B) 32. Multiply the A reg content and B(F0) reg content(A,R0A*B) 33. Move the content of A register(Product) to the DPTR(8300) 34. Move the carry register(R0) content to A register
35. Increment the DPTR (DPTR=8301) 36. Move the content of A register to DPTR(carry8301) 37. Stop the execution DIVISION: 38. Initialize the register R0 (reminder register) 39. Set DataPointer (DPTR) as 8300 (STA 40F3put address) 40. Move first data to the register R1 41. Move the content in R1 to A register 42. Move the 2nd data to the register R2 43. Move R2 register content to F0(B) 44. Divide the A reg content and B(F0) reg content(A,R0A/B) 45. Move the content of A register(Quotient) to the DPTR(8300) 46. Move the reminder register(R0) content to A register 47. Increment the DPTR (DPTR=8301) 48. Move the content of A register to DPTR(reminder8301) 49. Stop the execution. ADDITION: ADDRESS LABEL MNEMONICS COMMENTS 8000 CLR C Clear the content 8001 MOV R0,#00 Move 00 to R0 register 8003 MOV DPTR,#8300 Move 8300 to DPTR 8006 MOV R1,#FF Move data1 (FF) to R1 8008 MOV A,R1 Move it to accumulator 8009 MOV R2,#10 Move data2 (10) to R2 800B ADD A,R2 Add content of A with reg2 800C JNC 800F If no carry, go to label L1 800E INC R0 If carry exists, increment R0 800F L1 MOVX @DPTR,A Move A to DPTR 8011 MOV A,R0 Move R0(cy) to A 8012 INC DPTR Increment DPTR 8013 MOVX @DPTR,A Move A to DPTR 8014 LJMP 00 Long jump SUBTRACTION: ADDRESS LABEL MNEMONICS COMMENTS 8000 CLR C Clear the content 8001 MOV R0,#00 Move 00 to R0 register 8003 MOV DPTR,#8300 Move 8300 to DPTR 8006 MOV R1,#FF Move data1 (FF) to R1 8008 MOV A,R1 Move it to accumulator 8009 MOV R2,#10 Move data2 (10) to R2 800B ADD A,R2 Add content of A with reg2 800C JNC 800F If no carry, go to label L1 800E INC R0 If carry exists, increment R0 800F L1 MOVX @DPTR,A Move A to DPTR 8011 MOV A,R0 Move R0(cy) to A
8012
INC DPTR
Increment DPTR
8013 8014
MULTIPLICATION: ADDRESS LABEL MNEMONICS 8000 MOV R0,#00 8002 MOV DPTR,#8300 8005 MOV R1,#05 8007 MOV A,R1 8008 MOV R2,#07 800A MOV F0,R2 800C MUL AB 800D MOVX @DPTR,A 800E MOV A,R0 8010 INC DPTR 8011 MOVX @DPTR,A 8012 LJMP 00 DIVISION: ADDRESS LABEL MNEMONICS 8000 MOV DPTR,#8300 8003 MOV R1,#06 8005 MOV A,R1 8006 MOV R2,#03 8008 MOV F0,R2 800A DIV AB 800B MOVX @DPTR,A 800C INC DPTR 800D MOV A,F0 800F MOVX @DPTR,A 8010 LJMP 00
COMMENTS Move 00 to R0 register Move 8300 to DPTR Move data1 (05) to R1 Move it to accumulator Move data2 (07) to R2 Move it to F0 Multiply content A with reg2 Move A to DPTR Move R0(cy) to A Increment DPTR Move A to DPTR Long jump COMMENTS Move 8300 to DPTR Move data1 (06) to R1 Move it to accumulator Move data2 (03) to R2 Move it to F0 Divide content of A with reg2 Move A to DPTR Increment DPTR Move the content of F0 to A Move A to DPTR Long jump
RESULT: Thus the ALP that performs arithmetic operations (Addition, Subtraction, Multiplication, Division) using 8051 were written and executed successfully.
12.PROGRAMMING WITH 8051 LOGICAL OPERATIONS AIM: To write an ALP to perform logical operations using 8051 APPARATUS REQUIRED: 1. 8051 Micro controller kit. 2. Power supply And Keyboard. ALGORTIHM: SETTING A BIT: 1. Move an immediate data to accumulator. 2. Perform OR operations between immediate data to accumulator. 3. Set DPTR as 8500. 4. Move the contents of accumulator to DPTR(8500). MASKING A BIT: 1. Move an immediate data to accumulator. 2. Perform AND operations between immediate data to accumulator. 3. Set DPTR as 8500. 4. Move the contents of accumulator to DPTR(8500). SETTING A BIT: ADDRESS LABEL MNEMONICS OPCODE COMMENTS 8000 MOV A,#2F 74,2F Move 2F to accumulator 8002 ORL A,#45 44,45 Perform OR operation b/w 45 and accumulator 8004 MOV DPTR,#8500 90,85,0 Move 4500 to DPTR 8007 MOVX @DPTR,A F0 Move the contents of accumulator to DPTR address 8008 L1 SJMP 8508(L1) 80,FE Short jump to L1 MASKING A BIT: ADDRESS LABEL MNEMONICS OPCODE COMMENT 8000 MOV A,#87 74,87 Move 87 to accumulator 8002 ANL A,#7E 54,7E Perform AND operation between 7E and accumulator 8004 MOV DPTR,#8500 90,85,00 Move 4500 to DPTR 8007 MOVX @DPTR,A F0 Move the content of accumulator to DPTR address 8008 L1 SJMP L1 80,FE Short jump to L1 Setting a bit: Input STA 40F3put Address Data Address Data
RESULT: Thus the ALP that performs logical operations using 8051 was written and executed successfully
INTERFACING PRGRAMMABLE KEYBOARD AND DISPLAY CONTROLLER- 8279 AIM : To display the rolling message by using interfacing with 8085 to 8279 APPARATUS REQUIRED: 8085 Microprocessor kit, Power supply ALGORITHM : Display of rolling message HELP US 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.
1. Display Mode Setup: Control word-10 H 0 0 DD 00- 8Bit character display left entry 01- 16Bit character display left entry 10- 8Bit character display right entry 11- 16Bit character display right entry KKK- Key Board Mode 000-2Key lockout. 2.Clear Display: Control word-DC H 1 1 1 1 0 0 1 CD 1 CD 1 CD 0 CF 0 CA 0 0 0 0 1 D 0 D 0 K 0 K 0 K
11
1-Enables Clear display 0-Contents of RAM will be displayed 1-FIFO Status is cleared
AI
Selects one of the 16 rows of display. Auto increment = 1, the row address selected will be incremented after each of read and write operation of the display RAM.
FLOWCHART:
SET 8279 FOR 8-DIGIT CHARACTER DISPLAY SET 8279 FOR CLEARING THE DISPLAY WRITE THE COMMAND TO DISPLAY LOAD THE CHARACTER INTO ACCUMULATOR AND DISPLAY
DELAY
PROGRAM TABLE
PROGRAM START : MOV SI,1200H MOV CX,000FH MOV AL,10 OUT C2,AL MOV AL,CC OUT C2,AL MOV AL,90 OUT C2,AL L1 : MOV AL,[SI] OUT C0,AL CALL DELAY INC SI LOOP L1 JMP START DELAY : MOV DX,0A0FFH LOOP1 : DEC DX JNZ LOOP1 RET LOOK-UP TABLE: 1200 1204 98 FF 68 1C 7C 29 C8 FF Initialize array
COMMENTS Initialize array size Store the control word for display mode Send through output port Store the control word to clear display Send through output port Store the control word to write display Send through output port Get the first data Send through output port Give delay Go & get next data Loop until all the datas have been taken Go to starting location Store 16bit count value Decrement count value Loop until count values becomes zero Return to main program
RESULT: MEMORY LOCATION 1200H 1201H 1202H 7-SEGMENT LED FORMAT c b a dp e g 0 0 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 0 HEX DATA f 0 0 0 98 68 7C
d 1 0 0
1 1 0 0 1
1 1 0 0 1
0 1 0 1 1
0 1 0 0 1
1 1 1 1 1
0 1 1 0 1
0 1 0 0 1
0 1 0 1 1
C8 FF 1C 29 FF
Thus the rolling message HELP US is displayed using 8279 interface kit.
DATE:
SL.NO 1. 2. 3. 4.
QUANTITY 1 1 1 1
THEORY: The main features of the timer are, Three independent 16-bit counters Input clock from DC to 2 MHz Programmable counter modes Count binary or BCD The control signals with which the 8253 interfaces with the CPU are CS, RD, WR, A1, A2.The basic operations performed by 8253 are determined by these control signals. It has six different modes of operation, viz, mode 0 to mode 5.
Mode 31. 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. PORT ADDRESS : 1. CONTROL REGISTER 2. COUNTER OF CHANNEL 0 3. COUNTER OF CHANNEL 1 4. COUNTER OF CHANNEL 2 5. O/P PORT OF CHANNEL 0 6. O/P PORT OF CHANNEL 1 7. O/P PORT OF CHANNEL 2 CONTROL WORD FORMAT: D7 SC1 0 0 D6 SC0 0 0 D5 RL1 1 1 D4 RL0 1 1 D3 M2 0 0 D2 M1 1 1 D1 M0 0 1 D0 BCD 0 Mode 2 = 34 H 0 Mode 3 = 36 H READ/LOAD -
SC1 0 0 1 1 BCD M2 0 0 0 0 1 1
SC0
CHANNEL SELECT
RL1
RL0
0 CHANNEL 0 1 CHANNEL 1 0 CHANNEL 2 1 ------0 BINARY COUNTER M1 0 0 1 1 0 0 M0 0 1 0 1 0 1 MODE MODE 0 MODE 1 MODE 2 MODE 3 MODE 4 MODE 5
PORT PIN ARRANGEMENT 1 CLK 0 2 CLK 1 3 CLK 2 4 OUT 0 5 OUT 1 6 OUT 2 7 GATE 0 8 GATE 1 9 GATE 2 10 GND
Copy higher order count value in accumulator Send through output port Stop
STOP
RESULT: Thus an ALP for rate generator and square wave generator are written and executed.
DATE:
To study interfacing technique of 8251 (USART) with microprocessor 8086 and write an 8086 ALP to transmit and receive data between two serial ports with RS232 cable. APPARATUS REQUIRED: 8086 kit (2 Nos), RS232 cable. THEORY: The 8251 is used as a peripheral device for serial communication and is programmed by the CPU to operate using virtually any serial data transmission technique. The USART accepts data characters from the CPU in parallel format and then converts them into a continuous serial data stream for transmission. Simultaneously, it can receive serial data streams and convert them into parallel data characters for the CPU. The CPU can read the status of the USART at any time. These include data transmission errors and control signals. The control signals define the complete functional definition of the 8251. Control words should be written into the control register of 8251.These control words are split into two formats: 1) Mode instruction word & 2) Command instruction word. Status word format is used to examine the error during functional operation.
1...transmit enable 1...data terminal ready 1... receive enable 1... send break character 1.... reset error flags (pe,oe,fe) 1..... request to send (rts) 1...... internal reset 1....... enter hunt mode (enable search for sync characters)
1 ransmitter ready 1. receiver ready 1.. transmitter empty 1... parity error (pe) 1.... overrun error (oe) 1..... framing error (fe), async only
1...... sync detect, sync only 1....... data set ready (dsr)
ALGORITHM: 1. Initialize 8253 and 8251 to check the transmission and reception of a character 2. Initialize8253 to give an output of 150Khz at channel 0 which will give a 9600 baud rate of 8251. 3. The command word and mode word is written to the 8251 to set up for subsequent operations 4. The status word is read from the 8251 on completion of a serial I/O operation, or when the host CPU is checking the status of the device before starting the next I/O operation FLOW CHART: START
Is it High
Yes
STOP
PROGRAM: TRANSMITTER END PROGRAM COMMENTS MOV AL,36 Initialize 8253 in mode 3 square wave generator OUT CE,AL Send through port address MOV AL,10 Initialize AL with lower value of count (clock frequency 150KHz) OUT C8,AL Send through port address MOV AL,00 Initialize AL with higher value of count OUT C8,AL Send through port address MOV AL,4E Set mode for 8251(8bit data, No parity, baud rate factor 16x & 1 stop bit) OUT C2,AL Send through port address MOV AL,37 Set command instruction(enables transmit enable & receive enable bits) OUT C2,AL Send through port address L1:IN AL,C2 Read status word AND AL,04 Check whether transmitter ready JZ L1 If not wait until transmitter becomes ready MOV AL,41 Set the data as 41 OUT C0,AL Send through port address INT 2 Restart the system RECEIVER END PROGRAM COMMENTS MOV AL,36 Initialize 8253 in mode 3 square wave generator OUT CE,AL Send through port address MOV AL,10 Initialize AL with lower value of count (clock frequency 150KHz) OUT C8,AL Send through port address MOV AL,00 Initialize AL with higher value of count OUT C8,AL Send through port address MOV AL,4E Set mode for 8251(8bit data, No parity, baud rate factor 16x & 1 stop bit) OUT C2,AL Send through port address MOV AL,37 Set command instruction(enables transmit enable & receive enable bits) OUT C2,AL Send through port address L1:IN AL,C2 Read status word AND AL,02 Check whether receiver ready JZ L1 If not wait until receiver becomes ready IN AL,C0 If it is ready, get the data MOV BX,1500 Initialize BX register with memory location to store the data MOV [BX],AL Store the data in the memory location INT 2 Restart the system
RESULT: Thus ALP for serial data communication using USART 8251 is written and the equivalent ASCII 41 for character A is been transmitted & received.
DATE:
To write ALP by interfacing 8255 with 8086 in mode 0, mode 1 and mode 2 APPARATUS REQUIRED: 8086 kit, 8255 interface kit. ALGORITHM: Mode 0 1. Initialize accumulator to hold control word 2. store control word in control word register 3. Read data port A. 4. Store data from port A in memory 5. Place contents in port B Mode 1 & Mode 2 1. Initialize accumulator to hold control word (for port A) 2. Store control word in control word register 3. Initialize accumulator to hold control word (for port B) 4. Place contents in control word register. 5. Disable all maskable interrupts, enable RST 5.5 6. send interrupt mask for RST 6.5 & 7.5 7. Enable interrupt flag 8. Read data from port A, place contents in port B FLOWCHART Mode 0 START Store control word in control register Store control word in control register Input to be read from port A Input to be read from port A Disable all interrupts except RST 6.5 Store into accumulator Store output to port B Output written on port B STOP
MODE 0
PROGRAM MOV AL,90H OUT C6,AL IN AL,C0 OUT C2,AL HLT COMMENTS Set the control word Send it to control port Get the contents of port A in AL Send the contents of port B to port address Stop
MODE 1
PROGRAM MOV AL,0B0H OUT C6,AL MOV AL,09H OUT C6,AL MOV AL,13H OUT 30,AL MOV AL,0AH OUT 32,AL MOV AL,0FH OUT 32,AL MOV AL,00H OUT 32,AL STI HLT ISR: IN AL,C0 OUT C2,AL HLT Set trap flag Stop Subroutine Read from Port A Send it to Port B Stop PROGRAM MOV AL,0C0H OUT C6,AL MOV AL,09H OUT C6,AL MOV AL,13H OUT 30,AL COMMENTS Set the control word for mode 2 Send it to control port Control for BSR mode Send it to control port Interrupt generation Higher order count Using IR2 interrupt(lower order count) Through 8259 COMMENTS Set the control word for mode 1 Send it to control port Control for BSR mode Send it to control port Interrupt generation
MODE 2
MOV AL,0AH OUT 32,AL MOV AL,0FH OUT 32,AL MOV AL,00H OUT 32,AL STI HLT ISR: IN AL,C0 OUT C2,AL HLT BSR mode
D7 0 (0=BSR) D6 X
Through 8259 Using IR2 interrupt(lower order count) Higher order count Set trap flag Stop Subroutine Read from Port A Send it to Port B Stop
Bit set/reset, applicable to PC only. One bit is S/R at a time. Control word: D5 X D4 X D3 B2 D2 B1 D1 B0 D0 S/R (1=S,0=R)
Bit select: (Taking Don't care's as 0) B2 B1 B0 PC bit Control word (Set) Control word (reset) 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 2 3 4 5 6 7 0000 0001 = 01h 0000 0011 = 03h 0000 0101 = 05h 0000 0111 = 07h 0000 1001 = 09h 0000 1011 = 0Bh 0000 1101 = 0Dh 0000 1111 = 0Fh 0000 0000 = 00h 0000 0010 = 02h 0000 0100 = 04h 0000 0110 = 06h 0000 1000 = 08h 0000 1010 = 0Ah 0000 1100 = 0Ch 0000 1110 = 0Eh
I/O mode
D7 1 (1=I/O) D6 D5 D4 PA D3 PCU D2 GB mode select D1 PB D0 PCL GA mode select
D6, D5: GA mode select: o 00 = mode0 o 01 = mode1 o 1X = mode2 D4(PA), D3(PCU): 1=input 0=output D2: GB mode select: 0=mode0, 1=mode1 D1(PB), D0(PCL): 1=input 0=output
Result:
Mode 1 Input
Output
Mode 2 Input
Output
The programs for interfacing 8255 with 8085 are executed & the output is obtained for modes 0,1 & 2