Microprocessor Lab                  For IV Semester Electronics & CommunicationDepartment of Electronics & Communication S...
CONTENTS8085 MICROPROCESSOR LAB PROGRAMS1.    To move data block from one location to other without overlap2.    To move d...
Sri Siddhartha Institute of Technology1) (a) An ALP to transfer a given block of data from source memory block to destinat...
Sri Siddhartha Institute of Technology1 (b) An ALP to transfer a given block of data from source memory block to destinati...
Sri Siddhartha Institute of Technology2) An ALP to add 16-bit bytes/words & to find the average of numbers.               ...
Sri Siddhartha Institute of Technology3) An ALP to multiply two 32 bit numbers                                   data segm...
Sri Siddhartha Institute of Technology4)An ALP to multiply two ASCII byte numbers                                   data s...
Sri Siddhartha Institute of Technology5)(a) An ALP to find LCM of two 16 bit unsigned integers.                           ...
Sri Siddhartha Institute of Technology     5)(b) An ALP to find GCF of two 16 bit unsigned integers.                      ...
Sri Siddhartha Institute of Technology6)(a) An ALP to sort a given set of 16 bit unsigned integers into ascending order us...
Sri Siddhartha Institute of Technology6)(b) An ALP to sort a given set of 16 bit unsigned integers into ascending order us...
Sri Siddhartha Institute of Technology7) An ALP to generate 10 fibonacci numbers.(Read initial values via key board)      ...
Sri Siddhartha Institute of Technology8) An ALP to generate prime numbers from 1 to 50 BCD.                            dat...
Sri Siddhartha Institute of Technology9)An ALP to transfer given source string to destination string using string instruct...
Sri Siddhartha Institute of Technology10)An ALP to perform the following operations.    (a) Reverse a string.             ...
Sri Siddhartha Institute of Technology     (b)Deleting a word from a string.                               data segment   ...
Sri Siddhartha Institute of Technologyc)Searching a word from a string.                             data segment          ...
Sri Siddhartha Institute of Technology(d) To check whether a string is palindrome or not.               data segment      ...
Sri Siddhartha Institute of Technology11) An ALP to multiply two matrices .                                  data segment ...
Sri Siddhartha Institute of Technology12)(a) An ALP to find trace of a matrix.        data segment        matrix db 0ffh, ...
Sri Siddhartha Institute of Technology12)(b) An ALP to find the norms of the matrix.Program to find trace of the matrix   ...
Sri Siddhartha Institute of Technology13)An ALP to search that implements binary search algorithm.                        ...
Sri Siddhartha Institute of Technology                            Part-II 8051 8-bit Microcontroller1. Program to transfer...
Sri Siddhartha Institute of Technology2. Program to exchange data between two blocks          Starting address of block1, ...
Sri Siddhartha Institute of Technology3.Program to find average of n numbers.               ADDRESS            LABEL     M...
Sri Siddhartha Institute of Technology4. Program to multiply a 16 bit number with an 8 bit number          8 bit stored at...
Sri Siddhartha Institute of Technology5. Program to generate 10 Fibonacci numbers.          Stored in data memory address ...
Sri Siddhartha Institute of Technology. Program to find GCD & LCM of two 8-bit numbers.          Two 8-bit numbers are sto...
Sri Siddhartha Institute of Technology7(a) Program to add multibyte numbers                ADDRESS               LABEL   M...
Sri Siddhartha Institute of Technology7(b) program to subtract multibyte numbers                ADDRESS               LABE...
Sri Siddhartha Institute of Technology8.Program to search the key element in the block of data and displays it’s position ...
Sri Siddhartha Institute of Technology9. Program to sort the number in ascending order using bubble sort.                A...
Sri Siddhartha Institute of Technology                                     VISVESHWARAIAH TECHNOLOGICAL UNIVERSITY, BELGAU...
Operation Code-Sheet  Mnemonic      Hex        Mnemonic         Hex      Mnemonic        Hex       Mnemonic       Hex ACI ...
Upcoming SlideShare
Loading in...5
×

8086 labmanual

14,686

Published on

Published in: Technology, Business
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total Views
14,686
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
688
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "8086 labmanual"

  1. 1. Microprocessor Lab For IV Semester Electronics & CommunicationDepartment of Electronics & Communication Sri Siddhartha Institute of Technology Maralur, Tumkur
  2. 2. CONTENTS8085 MICROPROCESSOR LAB PROGRAMS1. To move data block from one location to other without overlap2. To move data block from one location to other with overlap3. To arrange a set of 8-bit numbers in ascending order4. Addition of binary numbers5. To add two multibyte binary numbers6. To add 2-digit BCD numbers7. To subtract 16-bit binary numbers8. To check the fourth bit of a byte9. To generate resultant byte for given Boolean equation10. Successive addition of two unsigned binary numbers11. To find the product of two unsigned binary numbers12. To divide two 16 bit numbers13. To implement counter from 00-9914. To implement counter from 99-0015. To implement counter from 00-FF16. To implement counter from FF-0017. To check 2 out of 5 code18. To add ‘N’ one byte binary numbers19. To realize real time clock20. To convert binary to BCD equivalent21. To convert binary to ASCII equivalent22. To convert ASCII to binary equivalent23. To convert BCD to binary equivalentINTERFACING PROGRAMS24. To generate square wave of given duty cycle using DAC25. To generate a triangular waveform using DAC26. To generate a staircase waveform using DAC27. To sense a keyboard28. To implement a moving display of a given string of digits29. To display a message on the display unit using 8279 chip30. To simulate throw of a dice
  3. 3. Sri Siddhartha Institute of Technology1) (a) An ALP to transfer a given block of data from source memory block to destination memory block without overlap data segment var1 dw 12h,34h,45h,67h,56h cnt dw 5 res dw ? data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov ax,cnt mov si,0000h next: mov ax,var1[si] mov res[si],ax inc si inc si loop next mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 1
  4. 4. Sri Siddhartha Institute of Technology1 (b) An ALP to transfer a given block of data from source memory block to destination memory block withoverlap data segment y db 3 dup(0) x db 11h,22h,33h,44h,55h data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax lea si,x lea di,y mov cx,0005h loc1: mov al,[si] mov[di],al inc si inc di dec cx jnz loc1 mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 2
  5. 5. Sri Siddhartha Institute of Technology2) An ALP to add 16-bit bytes/words & to find the average of numbers. data segment N1 dw 0020h,0002h,0002h,0002h res dw ? cnt db 04h data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov cl,cnt mov si,0000h mov dx,0000h next: mov ax,N1[si] add dx,ax inc si inc si loop next mov ax,dx div cnt mov res,ax mov ah,4Ch int 21h code ends end startDepartment of Electronics & Communication 3
  6. 6. Sri Siddhartha Institute of Technology3) An ALP to multiply two 32 bit numbers data segment n1 dw 0AFFh,0AFFh n2 dw 0330h,4002h res dw ? data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov si,0000h mov ax,n1[si] mul n2[si] mov res,ax mov bx,dx mov ax,n1[si+2] mul n2[si] add bx,ax mov cx,dx mov ax,n1[si] mul n2[si+2] add bx,ax adc cx,dx mov res+2,bx mov ax,n1[si+2] mul n2[si+2] mul n2[si+2] add cx,ax mov res+4,cx adc dx,0000h mov res+6,dx mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 4
  7. 7. Sri Siddhartha Institute of Technology4)An ALP to multiply two ASCII byte numbers data segment n1 db 3 n2 db 2 res db ? data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov al,n1 mov bl,n2 sub al,30h sub bl,30h mul bl aam add ax,3030h mov res,al mov res+1,ah mov ah,4Ch int 21h code ends end startDepartment of Electronics & Communication 5
  8. 8. Sri Siddhartha Institute of Technology5)(a) An ALP to find LCM of two 16 bit unsigned integers. data segment n1 dw 019h n2 dw 00Fh lcm dw 2 dup(?) data ends code segment assume cs:code,ds:datastart: Start: mov ax,data mov ds,ax mov ax,n1 mov bx,n2 mov dx,0000h again: push ax push dx div bx cmp dx,0000h je exit pop dx pop ax add ax,n1 jnc nincdx inc dx nincdx: jmp again exit: pop lcm+2 pop lcm mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 6
  9. 9. Sri Siddhartha Institute of Technology 5)(b) An ALP to find GCF of two 16 bit unsigned integers. data segment n1 dw 005Ah,0078h res dw ? data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov ax,n1 mov bx,n1+2 again: cmp ax,bx je exit jb big above: mov dx,0h div bx cmp dx,0 je exit mov ax,dx jmp again big: xchg ax,bx jmp above exit: mov res,bx mov ah,4Ch int 21h code ends end startDepartment of Electronics & Communication 7
  10. 10. Sri Siddhartha Institute of Technology6)(a) An ALP to sort a given set of 16 bit unsigned integers into ascending order using insertion sort.Program to sort a given a 16bit unsigned integers into ascending order using insertion sort data segment a dw 78h,34h,12h,56h si_ze dw ($-a)/2 data ends code segment assume cs:code,ds:data start : mov ax,data mov ds,ax mov cx,2 outloop: mov dx,cx dec dx mov si,dx add si,si mov ax,a[si] inloop : cmp a[si-2],ax jbe inexit mov di,a[si-2] mov a[si],di dec si dec si dec dx jnz inloop inexit : mov a[si],ax inc cx cmp cx,si_ze jbe outloop int 21h code ends end startDepartment of Electronics & Communication 8
  11. 11. Sri Siddhartha Institute of Technology6)(b) An ALP to sort a given set of 16 bit unsigned integers into ascending order using bubble sort. data segment a db 34h,78h,12h,56h size dw $-a data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov bx,size dec bx outloop: mov cx,bx mov si,0 inloop: mov al,a[si] inc si cmp al,a[si] jb nochang xchg al,a[si] mov a[si-1].al nochang: loop inloop dec bx jnz outloop mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 9
  12. 12. Sri Siddhartha Institute of Technology7) An ALP to generate 10 fibonacci numbers.(Read initial values via key board) data segment n db 01fh fib db 15 dup(?) data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov bx,0 term : mov dl,0 push bx call fibo pop bx cmp dx,n ja exit mov fib[bx],dx inc bx jmp term exit : mov ah,4ch int 3 fibo : cmp bx,0 je exit1 cmp bx,1 je exit2 dec bl push bx call fibo pop bx dec bx call fibo ret exit1: ret exit2: inc dl ret align 16 code ends end startDepartment of Electronics & Communication 10
  13. 13. Sri Siddhartha Institute of Technology8) An ALP to generate prime numbers from 1 to 50 BCD. data segment x db 2,14 dup(?) data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov dl,x lea si,x+1 mov ch,14 loc1: mov dh,02 inc dl loc2: mov ah,0 mov al,dl div dh cmp ah,0 je loc1 inc dh cmp dh,dl jb loc2 mov al,1 mul dl aam mov cl,04 rol al,cl ror ax,cl mov[si],al inc si dec ch jnz loc1 mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 11
  14. 14. Sri Siddhartha Institute of Technology9)An ALP to transfer given source string to destination string using string instructions. Data segment d1 db "welcome","$" d2 db 10dup(0) data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov es,ax mov cx,07h cld mov si,offset d1 mov di,offset d2 rep movsb mov cx,07h std mov si,offset d1+6 mov di,offset d2+14 rep movsb mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 12
  15. 15. Sri Siddhartha Institute of Technology10)An ALP to perform the following operations. (a) Reverse a string. data segment m1 db 10,13,enter the string:$ m2 db 10,13,reverse of a string:$ buff db 80 db 0 db 80 dup(0) counter1 dw 0 counter2 dw 0 data ends code segment assume cs: code, ds:data start: mov ax,data mov ds,ax mov ah,09h mov dx,offset m1 int 21h mov ah,0ah lea dx,buff int 21h mov ah,09h mov dx,offset m2 int 21h lea bx,buff inc bx mov ch,00 mov cl,buff+1 mov di,cx back: mov dl,[bx+di] mov ah,02h int 21h dec di jnz back exit: mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 13
  16. 16. Sri Siddhartha Institute of Technology (b)Deleting a word from a string. data segment x db aa,bb, cc,dd,ee,ff z dw (z-x)/2 data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov es,ax lea di,x mov cx,z cld mov ax,cc ;word to be deleted repne scasw cmp cx,0 je loc2 mov ax,[di] loc1: mov [di-2],ax inc di inc di dec cx jnz loc1 mov byte ptr[di-2],$ loc2: lea dx,x mov ah,09h int 21h mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 14
  17. 17. Sri Siddhartha Institute of Technologyc)Searching a word from a string. data segment n1 db 12h,14h,78h,67h,34h key db 23h cnt db 5 m1 db the key found in res db the position ,13h,10h,$ m2 db not found,13h,10h,$ data ends code segment assume cs: code,ds:data start: mov ax,data mov ds,ax mov si,00h mov cx,cnt next: mov al,n1[si] cmp al,key jz suc inc si loop next jmp fall suc: mov ax,si add al,01h add al,0 mov res,al lea dx,m1 jmp exit fall: lea dx,m2 jmp exit exit: mov ah,09h int 21h mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 15
  18. 18. Sri Siddhartha Institute of Technology(d) To check whether a string is palindrome or not. data segment inst db 20 dup(0) mes1 db 0Ah,0Dh,"insert the string:$" mes2 db 0Ah,0Dh,"it is a palindrome:$" mes3 db 0Ah,0Dh,"it is not a palindrome:$" data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov ah,09h lea dx,mes1 int 21 mov bx,00h up: mov ah,01h int 21h cmp al,0Dh jz down mov[inst+bx],al inc bx jmp up down: mov di,00h dec bx check: mov al,[inst+bx] cmp al,[inst+di] jne fail inc di dec bx jnz check jmp finish fail: mov ah,09h lea dx,mes3 int 21h jmp term finish: mov ah,09h lea dx,mes2 int 21h term: mov ah,4Ch int 21h code ends end startDepartment of Electronics & Communication 16
  19. 19. Sri Siddhartha Institute of Technology11) An ALP to multiply two matrices . data segment ar1 db 1h,2h,-3h ar2 db 4h,5h,6h ar3 db 2h,-1h,3h bc1 db 2h,4h,-4h bc2 db 3h,-2h,5h bc3 db 1h,5h,2h c db 9 dup (?) l2 db (?) l1 db (?) data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov es,ax mov bp,0h mov l2,3h lea si,ar1 repeat2: lea di,bc1 mov l1,3h repeat1: mov cx,3h mov bx,0h mov dl,0h again: mov al,[si][bx] imul byte ptr[di][bx] add dl,al inc bx loop again mov ds:c[bp],dl inc bp add di,3h dec l1 jne repeat1 add si,3h dec l2 jne repeat2 mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 17
  20. 20. Sri Siddhartha Institute of Technology12)(a) An ALP to find trace of a matrix. data segment matrix db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh ;3*3 row dw 0003h ;no. of rows col dw 0003h ;no. of cols trace dw ? data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov si,00h mov bx,00h mov ax,row cmp ax,col jnz fail mov ax,00h mov cx,row again: add al,matrix[si][bx] jnc skip inc ah skip: inc si add bx,col loop again mov trace,ax jmp ovr fail: mov trace,00h ovr: mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 18
  21. 21. Sri Siddhartha Institute of Technology12)(b) An ALP to find the norms of the matrix.Program to find trace of the matrix data segment matrix db 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh ;3x3row dw 0003h ;no. of rows col dw 0003h ;no. of cols norm dw 2 dup (0000h) data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov si,00h mov bx,00h mov ax,row cmp ax,col jnz fail mov cx,row again: mov ax,norm mov al,matrix[si][bx] mul matrix[si][bx] mov ax,norm jnc skip add norm+2,01h inc ah skip: mov norm,ax inc si add bx,0003h loop again jmp ovr fail: mov norm,00h ovr: mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 19
  22. 22. Sri Siddhartha Institute of Technology13)An ALP to search that implements binary search algorithm. data segment x dw 11h,22h,33h,44h,55h,66h,77h z dw (z-x) key dw 66h y dw ? data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov cx,key mov dx,z dec bx mov bx,0 loc3: mov si,bx add si,1 and si,0fffeh cmp cx,x[si] je loc1 jb loc2 add si,2 mov bx,si loc5: cmp bx,dx jna loc3 mov y,0 loc4: mov ah,4ch int 21h loc1: shr si,1 inc si mov y,si jmp loc1 loc2: sub si,2 mov dx,si jmp loc5 mov ah,4ch int 21h code ends end startDepartment of Electronics & Communication 20
  23. 23. Sri Siddhartha Institute of Technology Part-II 8051 8-bit Microcontroller1. Program to transfer a block from source to destination ADDRESS LABEL MNEMONIC 8000 MOV DPTR,#9000H 8003 MOV R0,#04H 8005 MOV R1,#90H 8007 MOV R2,#91H 8009 BACK MOVX A,@DPTR 800A MOV 83H,R2 800C MOVX @DPTR,A 800D MOV 83H,R1 800F INC DPTR 8010 DJNZ R0,8009(BACK) 8012 LCALL 0003Department of Electronics & Communication 21
  24. 24. Sri Siddhartha Institute of Technology2. Program to exchange data between two blocks Starting address of block1, data memory 9000& starting address of block2, data memory 9100. ADDRESS LABEL MNEMONIC 8000 MOV DPTR, #9000H 8003 MOV R0, #04H 8005 MOV R1, #90H 8007 MOV R2, #91H 8009 MOVX A, @DPTR 800A MOV R3, A 800B MOV 83H,R2 800D MOVX A, @DPTR 800E MOV 83H,R1 8010 MOVX @DPTR, A 8011 MOV A, R3 8012 MOV 83H,R2 8014 MOVX @DPTR, A 8015 MOV 83H,R1 8017 INC DPTR 8018 DJNZ R0, 8009 801A LCALL 0003Department of Electronics & Communication 22
  25. 25. Sri Siddhartha Institute of Technology3.Program to find average of n numbers. ADDRESS LABEL MNEMONIC 8000 MOV DPTR,#9000H 8003 MOV R0,#O4H 8005 MOV R1,#00H 8007 MOV R2,#00H 8009 CLR C 800A MOV R4,#04H 800C BACK MOVX A,DPTR 800D MOV R3,A 800E INC DPTR 800F MOV A,R1 8010 ADD A,R3 8011 JNC 8014H(AHEAD) 8013 IND R2 8014 AHEAD MOV R1,A 8015 DJNZ R0,800CH 8017 MOV R5,#00H 8019 CLR C 801A MOV A,R1 801B AGAIN SUBB A,R4 801C INC R5 801D JC 8021H 801F SJMP 801BH 8021 NEXT CJNE R2,#00H,802CH 8024 DEC R5 8025 ADD A,R4 8026 MOVX @DPTR,A 8027 MOV A,R5 8028 INC DPTR 8029 MOVX @DPTR,A 802A SJMP 802FH(END) 802C LOC DEC R2 802D SJMP 801BH 802F END LCALL 0003Department of Electronics & Communication 23
  26. 26. Sri Siddhartha Institute of Technology4. Program to multiply a 16 bit number with an 8 bit number 8 bit stored at data memory 9000 & 16 bit stored at data memory 9001 & 9002, result stored at data memory 9003, 9004 &9005. ADDRESS LABEL MNEMONIC 8000 MOV DPTR,#9000 8003 MOVX A,@DPTR 8004 MOV RO,A 8005 INC DPTR 8006 MOVX A,DPTR 8007 MOV R1,A 8008 INC DPTR 8009 MOVX A,DPTR 800B MOV F0,A 800C MOV A,RO 800D MUL AB 800E MOV R3,A 8010 MOV R4,F0 8012 MOV F0,R1 8013 MOV A,R0 8014 MUL AB 8015 MOV R5,A 8017 MOV R6,F0 8018 INC DPTR 8019 MOV A,R3 801A MOVX @DPTR,A 801B MOV A,R4 801C CLR C 801D INC DPTR 801E ADD A,R5 801F MOVX @DPTR,A 8021 MOV A,#00 8022 ADDC A,R6 8023 INC DPTR 8024 MOVX @DPTR,A 8026 LCALL 0003.Department of Electronics & Communication 24
  27. 27. Sri Siddhartha Institute of Technology5. Program to generate 10 Fibonacci numbers. Stored in data memory address 9000 & 9001 ADDRESS LABEL MNEMONIC 8000 MOV DPTR,#9000 8003 MOV R3,#08 8005 MOVX A,@DPTR 8006 MOV R0,A 8007 INC DPTR 8008 MOVX A,@DPTR 8009 BACK XCH A,R0 800A ADD A,R0 800B INC DPTR 800C MOVX @DPTR,A 800D DJNZ R3,BACK(8009) 800F LCALL 0003Department of Electronics & Communication 25
  28. 28. Sri Siddhartha Institute of Technology. Program to find GCD & LCM of two 8-bit numbers. Two 8-bit numbers are stored at location 9000&9001, GCD at location 9002 & LCM At location 9003 ADDRESS LABEL MNEUMONIC 8000 MOV DPTR,#9000H 8003 MOVX A,@DPTR 8004 MOV R0,A 8005 NOP 8006 INC DPTR 8007 MOVX A,@DPTR 8008 CJNE A,000H,NEXT(800D 800B SJMP AHEAD(8014) 800D JNC GO(8010) 800F XCH A,R1 8010 CLR C 8011 SUBB A,R0 8012 SJMP BACK(8008) 8014 INC DPTR 8015 MOVX @DPTR,A 8016 INC DPTR 8017 MOV 0F0H,A 8000 MOV 82H,#OOH 8000 MOVX A,@DPTR 8000 DIV AB 8000 MOV OFOH,A 8000 INC DPTR 8000 MOVX A,@DPTR 8000 MUL AB 8000 MOV 82H,#03H 8000 MOVX @DPTR,A LCALL 0003Department of Electronics & Communication 26
  29. 29. Sri Siddhartha Institute of Technology7(a) Program to add multibyte numbers ADDRESS LABEL MNEMONIC 8000 MOV DPTR,#9000H 8003 MOV R1,#04H 8005 MOV R2,#90H 8007 MOV R3,#91H 8009 MOV R4,#92H 800B CLR C 800C MOV 83H,R2 800E MOVX A,@DPTR 800F MOV R5,A 8010 MOV 83H,R3 8012 MOVX A,@DPTR 8013 ADDC A,R5 8014 MOV 83H,R4 8016 MOVX @DPTR,A 8017 INC DPTR 8018 DJNZ R1,800CH 801A JNC 801FH 801C MOV A,#01H 801E MOVX @DPTR,A 801F LCALL 0003Department of Electronics & Communication 27
  30. 30. Sri Siddhartha Institute of Technology7(b) program to subtract multibyte numbers ADDRESS LABEL MNEMONIC 8000 MOV DPTR,#9000H 8003 MOV R1,#04H 8005 MOV R2,#90H 8007 MOV R3,#91H 8009 MOV R4,#92H 800B CLR C 800C MOV 83H,R2 800E MOVX A,@DPTR 800F MOV R5,A 8010 MOV 83H,R3 8012 MOVX A,@DPTR 8013 SUBB A,R5 8014 MOV 83H,R4 8016 MOVX @DPTR,A 8017 INC DPTR 8018 DJNZ R1,800CH 801A LCALL 0003H 801C MOV A,#01H 801E MOVX @DPTR,A 801F LCALL 0003Department of Electronics & Communication 28
  31. 31. Sri Siddhartha Institute of Technology8.Program to search the key element in the block of data and displays it’s position and it’s position number ifit is found, else display not found. ADDRESS LABEL MNEOMONIC 8000 MOV 0DOH,#20H 8003 MOV DPTR,#9000H 8006 MOV R2,00H 8008 MOV R1,#04H 800A MOVX A,@DPTR 800B MOV R0,A 800C INC DPTR 800D INC R2 800E MOVX A,@DPTR 800F CJNE A,00H,8014H 8012 SJMP 801BH 8014 DJNZ R1,800CH 8016 MOV DPTR,#9500H 8019 SJMP 8025H 801B MOV A,R2 801C ADD A,#30H 801E MOV DPTR,#940CH 8021 MOVX @DPTR,A 8022 MOV DPTR,#9400H 8025 LCALL 164BH 8028 LCALL 0003Department of Electronics & Communication 29
  32. 32. Sri Siddhartha Institute of Technology9. Program to sort the number in ascending order using bubble sort. ADDRESS LABEL MNEMONIC 8000 MOV DPTR,#9000 8003 MOV R1,#04H 8005 AGAIN PUSH 82H 8007 MOV A,R1 8008 MOV R4,A 8009 MOV R2,82H 800B BACK MOVX A,@DPTR 800C MOV R3,A 800D INC DPTR 800E INC R2 800F MOVX A,DPTR 8010 CJNE A,03H,NEXT(8015) 8013 SJMP AHEAD(8020) 8015 NEXT JNC AHEAD 8017 DEC R2 8018 MOV 82H,R2 801A MOVX @DPTR,A 801B MOV A,R3 801C INC R2 801D MOV 82H,R2 801F MOVX @DPTR,A 8020 AHEAD DJNZ R4,BACK(800B) 8022 POP 82H 8024 NOP 8025 DJNZ R1,AGAIN(8005) 8027 LCALL 0003Department of Electronics & Communication 30
  33. 33. Sri Siddhartha Institute of Technology VISVESHWARAIAH TECHNOLOGICAL UNIVERSITY, BELGAUMBranch: EC Semester: VISubject code: EC6L2Subject title: Advanced microprocessor & Micro controller lab QUESTION BANKInstructions:1.Experiments on micro controller can be carried out using any 8-bit/16-bit micro controller kit.2.A student should be given only one question either from part-1 or from part-II for the examination.3.For each batch in examination, around 60% of the questions should be from part-I and around 40% of the questions should be from part-II.4.No change of experiment/question is permitted in the examination. PART-I1.Write an ALP to transfer a given block of data (byte/word) from source memory block to destination memory block with or without overlapping.2. Write an ALP to transfer given source string to destination using string instructions.3.Write an ALP to perform the following string operations: a) Reverse a string, search/delete a word from a string b) Check if the given string is palindrome or not.4.Write an ALP to add 16 bytes/words and find the average and display.5.write an ALP to multiply two 32 bit numbers and display.6.Write an ALP to multiply two ASCII byte numbers and display.7.Develop and execute an ALP to find GCF/LCM of two 16-bit unsigned integers.8.Develop and execute an ALP to sort a given set of 16-bit unsigned integers into ascending order using insertion/bubble sort algorithm.9.Write an ALP to generate 10 fibonacci numbers, Read initial values via keyboard.10.Write an Alp to generate prime numbers between 1 to 50 BCD.11.Write an ALP to multiply two matrices &display.12.Write an ALP to finda) Sum of principal diagonal elements (trace of a matrix)b) Norms of the matrix (sum of the squares of the principal diagonal elements)13.Develop and execute an ALP that implements binary search algorithm. Assume that the data consist of sorted 16-bit integers. Search key is also a 16-bitunsigned integer.14.Interface a logic controller via 8255 using I/O cards and perform the following operations.Read all the 8 inputs from the logic controller. Complement and display on the outputs. PART-II15.Write an Alp to transfer a block of data from a given source to destination using 8051/equivalent.16.Writ an ALP to find average of 10 data bytes in a memory using 8051/equivalent.17.Write an ALP to multiply 16bit by 8-bit data using micro controller.18 Write an ALP to generate 10 fibonacci numbers using 8051/equivalent.19.Interface a printer to 8051/equivalent to operate ina) Handshake modeb) Interrupt driven mode20.Develop and execute an ALP to find GCF/LCM of two 8-bit numbers using 8051/equivalent.21.Write an ALP to add/subtract two multibyte numbers using micro controller.22.Write an ALP to search a given key element from an array of integers using 8051/equivalent.23.Write an ALP to sort an array using bubble sort. Display the sorted array.24.Write an ALP to interchange two blocks of data residing at memory using 8051/equivalent.Department of Electronics & Communication 31
  34. 34. Operation Code-Sheet Mnemonic Hex Mnemonic Hex Mnemonic Hex Mnemonic Hex ACI 8-bit CE DCX SP 3B MOV D, H 54 RAR 1FADC A 8F DI F3 MOV D, L 55 RC D8ADC B 88 EI FB MOV D, M 56 RET C9ADC C 89 HLT 76 MOV E, A 5F RIM C2ADC D 8A IN 8-bit DB MOV E, B 58 RLC 07ADC E 8B INR A 3C MOV E, C 59 RM F8ADC H 8C INR B 04 MOV E, D 5A RNC D0ADC L 8D INR C 0C MOV E, E 5B RNZ C0ADC M 8E INR D 14 MOV E, H 5C RP F0ADD A 87 INR E 1C MOV E, L 5D RPE E8ADD B 80 INR H 24 MOV E, M 5E RPO E0ADD C 81 INR L 2C MOV H, A 67 RRC 0FADD D 82 INR M 34 MOV H, B 60 RST 0 C7ADD E 83 INX B 03 MOV H, C 61 RST 1 CFADD H 84 INX D 13 MOV H, D 62 RST 2 D7ADD L 85 INX H 23 MOV H, E 63 RST 3 DFADD M 86 INX SP 33 MOV H, H 64 RST 4 E7 ADI 8-bit C6 JC 16-bit DA MOV H, L 65 RST 5 EFANA A A7 JM 16-bit FA MOV H, M 66 RST 6 F7ANA B A0 JMP 16-bit C3 MOV L, A 6F RST 7 FFANA C A1 JNC 16-bit D2 MOV L, B 68 RZ C8ANA D A2 JNZ 16-bit C2 MOV L, C 69 SBB A 9FANA E A3 JP 16-bit F2 MOV L, D 6A SBB B 98ANA H A4 JPE 16-bit EA MOV L, E 6B SBB C 99ANA L A5 JPO 16-bit E2 MOV L, H 6C SBB D 9AANA M A6 JZ 16-bit CA MOV L, L 6D SBB E 9B ANI 8-bit E6 LDA 16-bit 3A MOV L, M 6E SBB H 9CCALL 16-bit CD LDAX B 0A MOV M, A 77 SBB L 9D CC 16-bit DC LDAX D 1A MOV M, B 70 SBB M 9E CM 16-bit FC LHLD 16-bit 2A MOV M, C 71 SBI 8-bit DECMA 2F LXI B, 16-bit 01 MOV M, D 72 SHLD 16-bit 22CMC 3F LXI D, 16-bit 11 MOV M, E 73 SIM 30CMP A BF LXI H, 16-bit 21 MOV M, H 74 SPHL F9CMP B B8 LXI SP, 16-bit 31 MOV M, L 75 STA 16-bit 32CMP C B9 MOV A, A 7F MVI A, 8-bit 3E STAX B 02CMP D BA MOV A, B 78 MVI B, 8-bit 06 STAX D 12CMP E BB MOV A, C 79 MVI C, 8-bit 0E STC 37CMP H BC MOV A, D 7A MVI D, 8-bit 16 SUB A 97CMP L BD MOV A, E 7B MVI E, 8-bit 1E SUB B 90CMP M BE MOV A, H 7C MVI H, 8-bit 26 SUB C 91CNC 16-bit D4 MOV A, L 7D MVI L, 8-bit 2E SUB D 92CNZ 16-bit C4 MOV A, M 7E MVI M, 8-bit 36 SUB E 93 CP 16-bit F4 MOV B, A 47 NOP 00 SUB H 94CPE 16-bit EC MOV B, B 40 ORA A B7 SUB L 95 CPI 8-bit FE MOV B, C 41 ORA B B0 SUB M 96CPO 16-bit E4 MOV B, D 42 ORA C B1 SUI 8-bit D6 CZ 16-bit CC MOV B, E 43 ORA D B2 XCHG EBDAA 27 MOV B, H 44 ORA E B3 XRA A AFDAD B 09 MOV B, L 45 ORA H B4 XRA B A8DAD D 19 MOV B, M 46 ORA L B5 XRA C A9DAD H 29 MOV C, A 4F ORA M B6 XRA D AADAD SP 39 MOV C, B 48 ORI 8-bit F6 XRA E ABDCR A 3D MOV C, C 49 OUT 8-bit D3 XRA H ACDCR B 05 MOV C, D 4A PCHL E9 XRA L ADDCR C 0D MOV C, E 4B POP B C1 XRA M AEDCR D 15 MOV C, H 4C POP D D1 XRI 8-bit EEDCR E 1D MOV C, L 4D POP H E1 XTHL E3DCR H 25 MOV C, M 4E POP PSW F1 UPDAD 06BFDCR L 2D MOV D, A 57 PUSH B C5 UPDDT 06D6DCR M 35 MOV D, B 50 PUSH D D5DCX B 0B MOV D, C 51 PUSH H E5DCX D 1B MOV D, D 52 PUSH PSW F5DCX H 2B MOV D, E 53 RAL 17Department of E & C SSIT

×