Anda di halaman 1dari 36

LABORATORY MANUAL ECE 306

UNIFIED ELECTRONICS LAB IV

1|Page

TABLE OF CONTENTS S. No. 1 2 3 4 5 6 7 8 9 10 11 12 Title of the Experiment Perform the basic programs using 8085 Microprocessor kit in assembly language. Interfacing of Seven segment displays with 8085 microprocessor. Interfacing and control of stepper motor using 8085 microprocessor. Interfacing of D/A converter with 8085 microprocessor. Design a 8085 Microprocessor based Traffic light control 8051 Assembly language programming using Keil compiler. (At least 5 programs.). Interfacing of LCD with8051 Microcontroller Interfacing of ADC with 8051 Microcontroller Interfacing of DAC with 8051 Microcontroller Interfacing of keyboard with 8051 Microcontroller Implementing of Serial Communication using 8051 Microcontroller Perform the basic programs using 8086 Microprocessor kit in assembly language. Page No. 3 9 11 12 13 15 21 24 29 30 34 36

Experiment 1
Aim: Perform the following using 8085 Microprocessor kit in assembly language. i. Write a program to add two 8-bit numbers. (Or) Write a program to add two 16-bit numbers. 2|Page

ii. iii. iv.

Write a program to subtract two 8-bit numbers. (Or) Write a program to subtract two 16-bit numbers. Write a program to multiply two 8 bit numbers by repetitive addition method. (Or) Write a program to multiply two 8 bit numbers by rotation method. Write a program to generate Fibonacci series.

Requirements: 8085 Microprocessor kit Program ( i.a ): Address 2000 2001 2002 2003 2004 2005 2006 2007 2008 Program ( i.b ): Address 2007 2008 2009 200A 200B 200C 200D 200E 200F 2010 2011 2012 2013 3|Page Machine Code / Data 2A 00 20 EB 2A 02 20 0E 00 19 D2 15 20 Label Mnemonics LHLD XCHG LHLD MVI DAD JNC Operands 2000h Comments Machine Code / Data 21 00 30 7E 23 86 23 77 EF Label Mnemonics LXI Operands H,3000h Comments

MOV INX ADD INX MOV RST5

A,M H M H M,A

2002h C,00h D KK

2014 2015 2016 2017 2018 2019 201A 201B 201C Program ( ii.a ): Address 2000 2001 2002 2003 2004 2005 2006 2007 2008

0C 22 04 20 79 32 06 20 EF

KK

INR SHLD MOV STA RST5

C 2004h A,C 2006h

Machine Code / Data 21 00 30 7E 23 96 23 77 EF

Label

Mnemonics LXI MOV INX SUB INX MOV RST5

Operands H,3000h A,M H M H M,A

Comments

Program ( ii.b ): Address 2007 2008 2009 200A 200B 200C 200D 200E 200F 2010 2011 2012 2013 2014 2015 4|Page Machine Code / Data 21 00 20 7E 23 96 32 04 20 23 7E 23 9E 32 05 Label Mnemonics LXI MOV INX SUB STA INX MOV INX SBB STA Operands H, 2000h A,M H M 2004h H A,M H M 2005h Comments

2016 2017 2018 2019 201A 201B 201C 201D Program ( iii.a ): Address 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 200A 200B 200C 200D 200E 200F 2010 2011 2012 2013 2014 2015

20 3E 00 17 32 06 20 EF

MVI RAL STA RST5

A, 00h 2006h

Machine Code / Data 3A 00 30 5F 16 00 3A 01 30 4F 21 00 00 19 0D C2 0D 20 22 02 30 EF

Label

Mnemonics LDA MOV MVI LDA MOV LXI

Operands 3000h E, A D, 00h 3001h C,A H, 0000h D C KK 3002h

Comments

KK

DAD DCR JNZ SHLD RST5

Program ( iii.b ): Address 2000 2001 2002 5|Page Machine Code / Data 21 01 25 Label Mnemonics LXI Operands H, 2501h Comments

2003 2004 2005 2006 2007 2008 2009 200A 200B 200C 200D 200E 200F 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 201A

5E 16 00 23 7E 21 00 00 06 08 29 13 D2 13 20 19 05 C2 0D 20 22 03 25 EF

MOV MVI INX MOV LXI MVI YY DAD RAL JNC DAD DCR JNZ SHLD RST5

E, M D, 00h H A, M H, 0000h B, 08h H KK D B YY 2503h

KK

Program ( iv ): Address 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 200A 200B 200C 200D 200E 200F 6|Page Machine Code / Data 21 00 25 3E 00 0E 0A 77 06 01 0D 23 80 70 57 78 Label Mnemonics LXI MVI MVI MOV MVI KK DCR INX ADD MOV MOV MOV Operands H, 2501h A, 00h C, 0Ah M, A B,01h C H B M, B D, A A, B Comments

2010 2011 2012 2013 2014 2015

42 0D C2 0B 20 EF

MOV DCR JNZ RST5

B, D C KK

Experiment 2
Aim: Interfacing of Seven segment display with 8085 microprocessor. Requirements: 8085 Microprocessor kit, Seven Segment LED & wires. Circuit Diagram:

Program: MVI A, 80H OUT 03h 7|Page

K: LXI H, 2000H MVI B, 10H KK: MOV A, M OUT 00h CALL DELAY INX H JNZ KK JMP K HLT Delay: LXI D, Count Back: DCX D MOV A, D ORA E JNZ Back RET Inputs: 2000: 40H, 79H, 24H, 30H, 19H, 12H, 02H, 78H, 00H, 18H, 08H, 03H, 46H, 21H, 06H, 0EH Result: On the Seven segment LED we can see all the Hexadecimal nos displayed with some delay as mentioned.

8|Page

Experiment 3
Aim: Interfacing and control of stepper motor using 8085 microprocessor. Requirements: 8085 Microprocessor kit, Stepper Motor, Motor driver circuit (ULN2003) & wires. Program: i) To rotate in Clock Wise direction MVI A, 80H OUT CR MVI A, 44H KK: OUT PA CALL DELAY RRLC JMP KK RST 5 ii) To rotate in Anti-Clock Wise direction MVI A, 80H OUT CR 9|Page

MVI A, 44H KK: OUT PA CALL DELAY RLC JMP KK RST 5 Delay: LXI D, Count Back: DCX D MOV A, D ORA E JNZ Back RET Result: Stepper motor rotates in Clock wise & Anti-clock wise direction.

Experiment 4:
Aim: Interfacing of D/A converter with 8085 microprocessor to generate RAMP wave. Requirements: 8085 Microprocessor Kit, DAC0808, 100nF(2), 1k, Op-Amp 741. Circuit Diagram:

Program: 10 | P a g e

MOV A, 80H OUT CW MVI A, 00H KK: OUT PA CALL DELAY INC A JMP KK RST 5 Delay: LXI D, Count Back: DCX D MOV A, D ORA E JNZ Back RET Result: On the CRO we can see a RAMP wave generated.

Experiment 5
Aim: Design a 8085 Microprocessor based Traffic light control for figure shown below with the following conditions: Allow traffic to flow from N to S & S to N for 1sec Glow all Yellow lights for 0.2sec Allow traffic to flow from W to E & E to W for 1sec Glow all Yellow lights for 0.2sec Make this process continues.

Requirements: 8085 Microprocessor Kit, 9 LEDs, 5K resistors (9) Circuit Diagram:

11 | P a g e

Program: MVI A, 80H : Initialize 8255, port A and port B OUT CR ;(CR) : in output mode START: MVI A, 09H OUT PA; (PA) : Send data on PA to glow R1 and R2 MVI A, 24H OUT PB; (PB) : Send data on PB to glow G3 and G4 MVI C, 28H : Load multiplier count (40) for delay CALL DELAY : Call delay subroutine MVI A, 12H OUT PA; PA : Send data on Port A to glow Y1 and Y2 OUT 81H ;PB : Send data on port B to glow Y3 and Y4 MVI C, 0AH : Load multiplier count (10) for delay CALL: DELAY : Call delay subroutine MVI A, 24H OUT 80H ;PA : Send data on port A to glow G1 and G2 MVI A, 09H OUT 81H; PB : Send data on port B to glow R3 and R4 MVI C, 28H : Load multiplier count (40) for delay 12 | P a g e

CALL DELAY : Call delay subroutine MVI A, 12H OUT 80H : Send data on port A to glow Y1 and Y2 OUT 81H : Send data on port B to glow Y3 and Y4 MVI C, 0AH : Load multiplier count (10) for delay CALL DELAY : Call delay subroutine JMP START Delay Subroutine: DELAY: LXI D, Count : Load count to give 0.5 sec delay BACK: DCX D : Decrement counter MOV A, D ORA E : Check whether count is 0 JNZ BACK : If not zero, repeat DCR C : Check if multiplier zero, otherwise repeat JNZ DELAY RET : Return to main program

Experiment 6
Aim: 8051 Assembly language programming using Keil compiler. (At least 5 programs.). a. Find the sum of the values 79H, F5H, E2H. Put the sum in register R0 (low byte) and R5 (high byte). b. Write a program to copy the values 55H into RAM memory locations 40H to 45H using i) Direct addressing mode ii) Register indirect addressing mode without using loop iii) With a loop c. Write a program to toggle all the bits of P1 after some delay d. Write a program to generate square wave of 50% duty cycle on bit 0 of port 1 e. Write a program to 13 | P a g e

i) Make P1 as input port. ii) To get hex data from P1 and convert it into decimal and save the digits in R7, R6, R5. f. Write a program to add two 16 bit numbers 3CE7H and 3B8DH. Place the sum in R7 and R6 (Lower Byte). g. A switch is connected to P1.7. Write a program to check the status of SW and perform the following: i) If SW=0, send letter N. to P2. ii) If SW=1, send letter Y. to P2. h. Write a program for Hex to ASCII conversion i. Write a program to generate square wave using timer Requirements: Keil software Program (a): Org 0000h mov a,#79h mov r5,#00h add a,#0f5h jnc here inc r5 here: add a,#0e2h jnc go inc r5 go: mov r0,a end Program (b): i) Direct addressing mode MOV A,#55 MOV 40H,A MOV 41H,A MOV 42H,A MOV 43H,A MOV 44H,A 14 | P a g e

MOV 45H,A ii) Register indirect addressing mode without using loop MOV R0,#40H MOV A,#55H MOV @R0,A //copy a to ram location r0 points to INC R0 MOV @R0,A INC R0 MOV @R0,A INC R0 MOV @R0,A INC R0 MOV @R0,A INC R0 END iii) With a loop. MOV R0,#40H MOV A,#55H GO:MOV @R0,A INC R0 CJNE R0,#46H, GO END Program (c): org 0000h again: mov p1,#55h acall delay mov p1,#0aah acall delay sjmp again delay:mov r0,#04h go3:mov r1,#0ffh go2:mov r2,#0ffh 15 | P a g e

go1:djnz r2,go1 djnz r1,go2 djnz r0,go3 ret end Program (d): org 0000h again:cpl p1.0 sjmp again end Program (e): Org 0000h mov a,#0ffh mov p1,a mov a,p1 mov b,#10 div ab mov r7,b mov b,#10 div ab mov r6,b mov r5,a end Program (f): org 0000h mov r5,#00h mov a,#0e7h add a,#8dh mov r6,a mov a,#3ch addc a,#3bh jnc go inc r5 16 | P a g e

go: mov r7,a end Program (g): org 0000h setb p1.7 again:mov c,p1.7 jnc go mov p2,#'Y' go:mov p2,#'N' sjmp again end Program (h): org 0000h mov a,#2dh mov r1,a anl a,#0fh acall char mov r2,a mov a,r1 swap a anl a,#0fh //mov the lower nibble to r2 acall char mov r3,a here:sjmp here char: cjne a,#0ah,out1 mov a,#41h //to get 41 sjmp go out1:cjne a,#0bh,out2 mov a,#42h //to get 42 sjmp go out2:cjne a,#0ch,out3 mov a,#43h //to get 43 17 | P a g e

sjmp go sjmp code1 code1: out3:cjne a,#0dh,out4 mov a,#44h //to get 44 sjmp go out4:cjne a,#0eh,out5 mov a,#45h //to get 45 sjmp go out5:cjne a,#0fh,out mov a,#46h //to get 46 sjmp go out: orl a,#30h go: ret end

Program (i): org 0000h again:mov tmod,#01h mov th0,#01h mov tl0,#00h cpl p1.1 setb tr0 here: jnb tf0,here clr tr0 clr tf0 sjmp again end 18 | P a g e

Experiment 7
Aim: Interfacing of LCD with8051 Microcontroller Requirements: 8051, 11.0592MHz Crystal, 33pF (2), 10uF, 10K, push button, 1K (10), LCD (Liquid Crystal Display), Bread Board, Connecting wires, 5V power supply. Circuit Diagram:

19 | P a g e

Program: ORG 0000H MOV A,#38H ACALL COM MOV A,#0EH ACALL COM MOV A,#01H ACALL COM MOV A,#10H ACALL COM MOV A,#80H ACALL COM AGAIN: ACALL DISPLAY MOV A,#01H ACALL COM SJMP AGAIN COM:ACALL DELAY 20 | P a g e

CLR P2.0 CLR P2.1 SETB P2.2 MOV P1,A ACALL DELAY CLR P2.2 ACALL DELAY RET DATA1: ACALL DELAY SETB P2.0 CLR P2.1 SETB P2.2 MOV P1,A ACALL DELAY CLR P2.2 ACALL DELAY RET DELAY: GO: MOV R0,#15H MOV TMOD,#01H MOV TL0,#0FFH MOV TH0,#0DBH SETB TR0 BACK: JNB TF0,BACK CLR TR0 CLR TF0 DJNZ R0,GO RET DISPLAY: MOV R1,#14D MOV A,#00H MOV DPTR,#MYDATA NEXT: CLR A MOVC A,@A+DPTR JZ OUT 21 | P a g e

ACALL DATA1 INC DPTR CLR A DJNZ R1,NEXT OUT: RET END MYDATA:DB "*I LOVE INDIA*"

Experiment 8
Aim: Interfacing of ADC with 8051 Microcontroller Requirements: 8051, 11.0592MHz Crystal, 33pF (2), 10uF, 10K, push button, 1K (10), Analog to Digital Convertor (ADC0808), Bread Board, Connecting wires, 5V power supply 22 | P a g e

Circuit Diagram:

Program : ORG 0000H LJMP MAIN ;jump to main progam ORG 000B ;address of Timer 0 interrupt CPL P2.3 ;generation of less than 100MHz frequency RETI MAIN: ORG 0300H LCALL LCD ;Initialisaiton of LCD ACALL DISPLAY MOV TMOD,#02H ;initialisation of timer 0 MOV TH0,0D8H ;delay for more than 100MHz frequency MOV IE,#82H ;Enable Timer interrut 0 SETB TR0 ;Start timer MOV P0,#0FFH ;Make P0 as input port SETB P2.7 ;make EOC an input port 23 | P a g e

CLR P2.4 ;clear ALE CLR P2.6 ;clear WR i.e. start of conversion CLR P2.5 ;clear RD i.e. out enable CLR P3.7 ;For the selection of data bus for 3. SETB P3.6 SETB P3.5 BACK:ACALL DELAY SETB P2.4 ;ALE ACALL DELAY SETB P2.6 ;SC ACALL DELAY CLR P2.4 ;ALE CLR P2.6 ;SC HERE:JB P2.7,HERE ;wait untill done SETB P2.5 ACALL DELAY_1 MOV A,P0 CLR P2.5 ACALL CONVERSION ACALL DISPLAY SJMP BACK CONVERSION: ;conversion from HEX to BCD MOV B,#0AH DIV AB MOV R0,B MOV B,#10 DIV AB MOV R1,B MOV R2,A MOV A,R0 ADD A,#30H MOV R0,A MOV A,R1 24 | P a g e

ADD A,#30H MOV R1,A MOV A,R2 ADD A,#30H MOV R2,A RET LCD: ;Initialization of LCD MOV A,#38H ACALL COMM ACALL DELAY_1 MOV A,#0EH ACALL COMM ACALL DELAY_1 MOV A,#01H ACALL COMM ACALL DELAY_1 MOV A,#06H ACALL COMM ACALL DELAY_1 MOV A,#80H ACALL COMM ACALL DELAY_1 RET DISPLAY: MOV A,#'T' ACALL WRITE MOV A,#'E' ACALL WRITE MOV A,#'M' ACALL WRITE MOV A,#'P' ACALL WRITE MOV A,#'.' 25 | P a g e

ACALL WRITE MOV A,#' ' ACALL WRITE MOV A,R2 ACALL WRITE MOV A,R1 ACALL WRITE MOV A,R0 ACALL WRITE MOV A,#'`' ACALL WRITE MOV A,#'C' ACALL WRITE ACALL DELAY_1 MOV A,#80H ACALL COMM RET COMM: MOV P1,A CLR P2.0 CLR P2.1 SETB P2.2 ACALL DELAY_1 CLR P2.2 RET WRITE: MOV P1,A SETB P2.0 CLR P2.1 SETB P2.2 ACALL DELAY_1 CLR P2.2 RET 26 | P a g e

DELAY_1: MOV R4,#01H HERE11:MOV R5,#0FFH HEREE:DJNZ R5,HEREE DJNZ R4,HERE11 RET DELAY: MOV R6,#50 HERE55:DJNZ R6,HERE55 RET END

Experiment 9
Aim: Interfacing of DAC with 8051 Microcontroller

27 | P a g e

Requirements: 8051, 11.0592MHz Crystal, 33pF (2),100nF(2), 10uF, 10K, push button, 10K resistor(1),1k resistor(1), DAC0808, Op-Amp 741, Bread Board, Connecting wires, 5V & 12V split power supply, Circuit Diagram:

Program: ;Generation of Triangle wave org 0000h again:mov a,#00h ;minimum magnitude back:mov p2,a ;mag. copy to p2 cjne a,#0ffh,next ;max. mag. sjmp triangle next: inc a sjmp back triangle: ;for slope down mov r0,a djnz r0,again mov p2,r0 sjmp triangle end

Experiment 10
Aim: Interfacing of keyboard with 8051 Microcontroller 28 | P a g e

Requirements: 8051, 11.0592MHz Crystal, 33pF (2), 10uF, 10K, push button (5 piece for Key-Board),4k7 resistor,10k resistor, 1K (10), LCD, Bread Board, Connecting wires, 5V power supply Circuit Diagram:

Program: //Interfacing of keyboard with lcd org 0000h acall lcd acall keyboard lcd: mov a,#38h //2*16 matrix lcd acall command mov a,#0eh //dispaly on cursor on acall command mov a,#01h acall command 29 | P a g e

mov a,#06h acall command mov a,#80h acall command ljmp code2 code2: ret command: acall delay mov p1,a clr p3.0 clr p3.1 setb p3.2 acall delay clr p3.2 ret data1: acall delay mov p1,a setb p3.0 clr p3.1 setb p3.2 acall delay clr p3.2 acall delay ret delay: mov r0,#15h go:mov tmod,#01h mov tl0,#0ffh mov th0,#0dbh setb tr0 back:jnb tf0,back 30 | P a g e

clr tr0 clr tf0 djnz r0,go ret keyboard: mov p2,#0ffh k1:mov p0,#00h //checking of keyboard's mov a,p2 anl a,#03h cjne a,#03h,k1 k2: acall delay mov a,p2 anl a,#03h cjne a,#03h,over sjmp k2 over:acall delay //checking for row mov a,p2 anl a,#03h cjne a,#03h,over1 sjmp k2 over1: mov p0,#0feh mov a,p2 anl a,#03h cjne a,#03h,row0 mov p0,#0fdh mov a,p2 anl a,#03h cjne a,#03h,row1 ljmp k2 row0: mov dptr,#code0 31 | P a g e

sjmp find row1: mov dptr,#code1 sjmp find find: rrc a jnc match inc dptr sjmp find match: clr a movc a,@a+dptr acall data1 ljmp k1 code0: db '1','2' code1: db '3','4' end

Experiment 11
32 | P a g e

Aim: Implementing of Serial Communication using 8051 Microcontroller i) To transfer letter A serially at 4800 baud, continuously ii) To receive bytes of data serially and put them in P1 Requirements: 8051, 11.0592MHz Crystal, 33pF (2), 10uF, 10K, push button, MAX232, RS232 DB-9 Connector. Circuit Connections:

Program: i) ORG 00H MOV TMOD,#20H ; Timer 1, mode 2(auto-reload) MOV TH1,#-6 ; 4800 baud rate MOV SCON,#50H ; 8 bit, 1 stop, REN enabled SETB TR1 AGAIN: MOV SBUF,# A ; letter A to be transfered HERE: JNB TI,HERE CLR TI ; clear TI for next char SJMP AGAIN ; keep sending A

33 | P a g e

ii) ORG 0H MOV TMOD, #20H ; timer 1, mode 2 MOV TH1,#-6 ; 4800 baud MOV SCON, #50H ; 8 bit, 1 stop, REN enabled SETB TR1 HERE: JNB RI, HERE ; wait for char to come in MOV A, SBUF ; save incoming byte in A MOV P1, A ; send to port 1 CLR RI ; get ready to receive next byte SJMP HERE ; keep getting data END

Experiment 12 34 | P a g e

Aim: Perform the basic programs using 8086 Microprocessor kit in assembly language. a. Write a program to move block of nos using repeat instruction using 8086 Microprocessor kit. b. Write a program to find smallest of given n numbers using 8086 Microprocessor kit. Requirements: 8086 Microprocessor kit Program (a) : Address 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 300A 300B Program (b): Address 2012 2013 2014 2015 2016 2017 2018 2019 201A 201B 201C 201D 201E 201F 2020 2021 35 | P a g e Machine Code / Data BE 00 20 B1 05 8A 04 46 3A 04 7C 02 86 04 E2 F7 Label Mnemonics MOVW MOVB MOVB L1: INCW CMPB JL XCHGB L2: LOOP Operands SI, 2000H CL, 05H AL, [SI] SI AL, [SI] L2 AL, [SI] L1 Comments Machine Code / Data B1 07 BE 00 40 BF 00 50 FC F3 A4 CC Label Mnemonics MOVB MOVW MOVW CLD REP MOVSB INT Operands CL, 07 SI, 4000H DI, 5000H Comments

DI, SI 03

2022 2023 2024 2025

A2 00 10 CC

MOVB INT

@1000,AL 03

Aim: Write a program to find largest of given n numbers using 8086 Microprocessor kit. Requirements: 8086 Microprocessor kit Program: Address 2012 2013 2014 2015 2016 2017 2018 2019 201A 201B 201C 201D 201E 201F 2020 2021 2022 2023 2024 2025 Machine Code / Data BE 00 20 B1 05 8A 04 46 3A 04 7C 02 86 04 E2 F7 A2 00 05 CC Label Mnemonics MOVW MOVB MOVB L1: INCW CMPB JG XCHGB L2: LOOP MOVB INT Operands SI, 2000H CL, 05H AL, [SI] SI AL, [SI] L2 AL, [SI] L1 @500,AL 03 Comments

36 | P a g e

Anda mungkin juga menyukai