BM Dept., Govt. Engg. College, Gandhinagar Page 1 Microcontroller & Interfacing Laboratory Manual Enrollment No.: Name of the
Lab Manual of Microcontroller & Interfacing Page 10 EXPERIMENT NO. 2 AIM: Write a C language programs to… • Read data from port P2 and P3. Add
BM Dept., Govt. Engg. College, Gandhinagar Page 11 Program 3: Write program to read switch connected at port pin P1.0, toggle it and send it to port
Lab Manual of Microcontroller & Interfacing Page 12 C. Write C language program to read port P1, Compare content of port P1with data 80h. If da
BM Dept., Govt. Engg. College, Gandhinagar Page 13 EXPERIMENT NO. 3 AIM: Write programs to …. • To add two sixteen bit numbers stored in DPTR and a
Lab Manual of Microcontroller & Interfacing Page 14 ADDC A,#00h ;Add zero (plus the carry, if any) MOV R1,A ;Move the resulting answer
BM Dept., Govt. Engg. College, Gandhinagar Page 15 :: WORKSHEET :: Exercise: A. Write assembly language program to find square of given number stor
Lab Manual of Microcontroller & Interfacing Page 16 B. Write assembly language program to add 4 digit BCD numbers. First 4 digit number stored
BM Dept., Govt. Engg. College, Gandhinagar Page 17 C. Divide content of register R1 by 8 using logical shift instruction. Memory Location HEX code
Lab Manual of Microcontroller & Interfacing Page 18 EXPERIMENT NO. 4 AIM: Write a program to …. • Add block of data stored at location 40h to 4
BM Dept., Govt. Engg. College, Gandhinagar Page 19 JC next ;If A<next data then check next data MOV 60h,R0 ;Save smallest location at R
Lab Manual of Microcontroller & Interfacing Page 2 GGGGOOOOVVVVEEEERRRRNNNNMMMMEEEENNNNTTTT EEEENNNNGGGGIIIINNNNEEEEEEEERRRRIIIINNNNGGGG
Lab Manual of Microcontroller & Interfacing Page 20
BM Dept., Govt. Engg. College, Gandhinagar Page 21
Lab Manual of Microcontroller & Interfacing Page 22
BM Dept., Govt. Engg. College, Gandhinagar Page 23 EXPERIMENT NO. 5 AIM: Write a program to …. • Keep monitoring port pin P1.2 until it becomes hig
Lab Manual of Microcontroller & Interfacing Page 24 :: WORKSHEET :: A. Write assembly language and C program to make ALL LEDs connected at port
BM Dept., Govt. Engg. College, Gandhinagar Page 25 D. A switch is connected to P3.2. Write a program to perform following: a. If Switch is OFF, se
Lab Manual of Microcontroller & Interfacing Page 26 EXPERIMENT NO. 6 AIM: Write a program to generate square wave of 50% duty cycle having frequ
BM Dept., Govt. Engg. College, Gandhinagar Page 27
Lab Manual of Microcontroller & Interfacing Page 28
BM Dept., Govt. Engg. College, Gandhinagar Page 29 EXPERIMENT NO. 7 Aim: Generate external interrupt INT0 and INT1 by connecting push button switch.
BM Dept., Govt. Engg. College, Gandhinagar Page 3 INDEX Sr. No. Name of Experiment Date Sign 1 Write a assembly language program to …. • Ad
Lab Manual of Microcontroller & Interfacing Page 30 ajmp flash sequence: mov a,#0FEh ; Bit pattern for First LED ON, others OFF next: mov P
BM Dept., Govt. Engg. College, Gandhinagar Page 31 EXPERIMENT NO. 8 Aim: Interface seven segment display with Port P1. Write program to display numb
Lab Manual of Microcontroller & Interfacing Page 32 INC DPTR AJMP next ; Next digit DELAY: MOV R7,#22h L3: MOV R6,#0FFh L2: MOV R5,#
BM Dept., Govt. Engg. College, Gandhinagar Page 33 ACALL DELAY MOVC A,@A+DPTR MOV P1,A ;Display count value AJMP again ;Continue DIP switch reading
Lab Manual of Microcontroller & Interfacing Page 34 EXPERIMENT NO. 9 AIM: Interface LCD with the microcontroller. Display your name on the LCD.
BM Dept., Govt. Engg. College, Gandhinagar Page 35 between two data which gives enough time to LCD for its operation and does not require to check t
Lab Manual of Microcontroller & Interfacing Page 36 acall delay clr a movc a,@a+dptr jz exit acall disp_data inc dptr sjmp disp_msg exit: ret de
BM Dept., Govt. Engg. College, Gandhinagar Page 37
Lab Manual of Microcontroller & Interfacing Page 38
BM Dept., Govt. Engg. College, Gandhinagar Page 39 EXPERIMENT NO. 10 AIM: Write a program to transmit letter “E” continuously using serial port. Mod
Lab Manual of Microcontroller & Interfacing Page 4 Sr. No. Name of Experiment Date Sign 8. Interface seven segment display with Port P2.
Lab Manual of Microcontroller & Interfacing Page 40 START: MOV TMOD,#20h ;Configure Timer 1 in mode 2 auto reload mode. MOV TH1,#0fdh
BM Dept., Govt. Engg. College, Gandhinagar Page 41 MOV P1,#0ffh ;Make P1 output port MOV P2,#00h ;Make P2 output port MOV TMOD,#20h ;Tim
Lab Manual of Microcontroller & Interfacing Page 42
BM Dept., Govt. Engg. College, Gandhinagar Page 43
Lab Manual of Microcontroller & Interfacing Page 44 EXPERIMENT NO. 11 AIM: Write a program to receive bytes of data serially and displ
BM Dept., Govt. Engg. College, Gandhinagar Page 45 MOV TH1,#0FDh ;Count value for baud rate 9600 MOV SCON,#50h ;8 bit UART mode, REN enable MOV
Lab Manual of Microcontroller & Interfacing Page 46 /* 0x06 = 19,200 BPS 0x0C = 9,600 BPS 0x18 = 4,800 BPS */ /* 0x30 = 2,400 BPS */ outportb(PO
BM Dept., Govt. Engg. College, Gandhinagar Page 47 MOV TH1,#0FDh ;Count value for baud rate 9600 MOV SCON,#50h ;8 bit UART mode, REN enable
Lab Manual of Microcontroller & Interfacing Page 48
BM Dept., Govt. Engg. College, Gandhinagar Page 49 EXPERIMENT NO. 12 AIM: Write a program to measure frequency of external pulses given at the timer
BM Dept., Govt. Engg. College, Gandhinagar Page 5 EXPERIMENT NO. 1 AIM: Write a program to …. • Add two 8 bit numbers stored in register R6 and R7.
Lab Manual of Microcontroller & Interfacing Page 50 ORG 1BH RETI ORG 23H RETI START: MOV SP,#60H MOV P1,#00H ;Set P1 as an output port MOV P
BM Dept., Govt. Engg. College, Gandhinagar Page 51 MOV A,37H ;Convert the number stored at 37h into ASCII ACALL HEXASCI ACALL DISP_DATA ; Di
Lab Manual of Microcontroller & Interfacing Page 52 MOV A,@R0 MOV B,#6 MUL AB DEC R0 DEC R0 ADD A,@R0 MOV @R0,A INC R0 INC R0 MOV A,@R0 MOV B,#5
BM Dept., Govt. Engg. College, Gandhinagar Page 53 ACALL DELAY MOV P1,A ;Get data for display SETB P3.0 ;Select data register CLR P3.2
Lab Manual of Microcontroller & Interfacing Page 54
BM Dept., Govt. Engg. College, Gandhinagar Page 55 EXPERIMENT NO. 13 AIM: Interface matrix keyboard with 8051. Write program to display key pressed
Lab Manual of Microcontroller & Interfacing Page 56 ANL A,#0FH ;Maks Upper Bits Because They Are Not Used CJNE A,#0FH,REL ;Check Till All K
BM Dept., Govt. Engg. College, Gandhinagar Page 57 INC DPTR SJMP CHECK_C GET_CODE: CLR A MOVC A,@A+dptr MOV P0,A LJMP REL DELAY: MOV R7,#0FFh DLOO
Lab Manual of Microcontroller & Interfacing Page 58
BM Dept., Govt. Engg. College, Gandhinagar Page 59
Lab Manual of Microcontroller & Interfacing Page 6 :: WORKSHEET :: A. Write assembly language program to add two 8 bit data stored at memory lo
Lab Manual of Microcontroller & Interfacing Page 60 EXPERIMENT NO. 14 AIM: Interface stepper motor with port P0 of the microcontroller.
BM Dept., Govt. Engg. College, Gandhinagar Page 61 Sequence of pulses required to send on port P0 to rotate motor in clockwise and anticlockwise di
Lab Manual of Microcontroller & Interfacing Page 62 Sequence of pulses required to send on port P0 to rotate motor in clockwise and anticlockwis
BM Dept., Govt. Engg. College, Gandhinagar Page 63 Memory Location HEX code Label Opcode Operands Comments
Lab Manual of Microcontroller & Interfacing Page 64 B. Consider that switch SW1 and SW2 shown in the circuit are two limit switche
BM Dept., Govt. Engg. College, Gandhinagar Page 65 EXPERIMENT NO. 15 AIM: Interface DC motor with AT89C51 microcontroller. Write a program to rotate
Lab Manual of Microcontroller & Interfacing Page 66 pulses decreases when we press the switch SW2. This will control speed of the motor. Transis
BM Dept., Govt. Engg. College, Gandhinagar Page 67 When port pin P1.1 is low, LED of opto-isolator will glow which makes transistor of opto-is
Lab Manual of Microcontroller & Interfacing Page 68 H-bridge is available in single IC form such as L293. Four transistors are inbuilt in this
BM Dept., Govt. Engg. College, Gandhinagar Page 69 Program: Write a program to rotate DC motor connected in above circuit such that when switch SW1
BM Dept., Govt. Engg. College, Gandhinagar Page 7 D. Writ
Lab Manual of Microcontroller & Interfacing Page 70
BM Dept., Govt. Engg. College, Gandhinagar Page 71
Lab Manual of Microcontroller & Interfacing Page 72 EXPERIMENT NO. 16 AIM: Interface ADC0808 with AT89C51 microcontroller. Write a progr
BM Dept., Govt. Engg. College, Gandhinagar Page 73 SETB EOC ; MAKE EOC INPUT CLR ALE CLR OE CLR START SETB START ACALL SDELAY CLR START HERE:
Lab Manual of Microcontroller & Interfacing Page 74 :: WORKSHEET:: A. Write a program to read analog value at the interval of 1 second and stor
BM Dept., Govt. Engg. College, Gandhinagar Page 75 B. Draw interfacing diagram to interface ADC0804 with AT89C51 microcontroller. Write program to
Lab Manual of Microcontroller & Interfacing Page 76
BM Dept., Govt. Engg. College, Gandhinagar Page 77 EXPERIMENT NO. 17 AIM: Interface 8 bit DAC chip with 89C51 microcontroller. Write a program to ge
Lab Manual of Microcontroller & Interfacing Page 78 org 0400h DB 1,8,16,24,32,40,47,54,62,69,75,82,88,93,99,104,108,112,116,119,122,124,124 DB 1
BM Dept., Govt. Engg. College, Gandhinagar Page 79 B. Modify DAC program to generate Full wave rectifier w
Lab Manual of Microcontroller & Interfacing Page 8 F. Write and execute program to subtract content of register R6 from register R7 and store
Lab Manual of Microcontroller & Interfacing Page 80 Component list for microcontroller mini-project and practical: Part 1: List of components co
BM Dept., Govt. Engg. College, Gandhinagar Page 9 :: Rough Work ::
Comments to this Manuals