exp8
exp8
Experiment No.8
AIM: Write a program of flashing LED connected to the port 1.0 by using 8051.
Microcontroller.
Apparatus used: 8051 Microcontroller kit, Keyboard and Power supply.
Procedure: The following steps are required to implement the program-
1. Connect the 8051microcontroller kit to the power supply.
2. Press reset button of the kit.
3. Input the program manually by using the keyboard by following proper instructions.
4. Execute the program.
5. Now see the result in the kit.
Program Code for Flashing LED-
Memory Machine Label Mnemonics Operand Comments
Address Codes
6000 3E 80H MVI A 80 Load the immediate value 80H into
the accumulator
6002 D3 F3H OUT F3
Send the contents of register A
(currently 80H) to the I/O port with
address F3H
6004 3E A4H BACK MVI A A4
Load the immediate value A4SH into
the accumulator (register A)
6006 D3 F1H OUT F1 Send the contents of register A
(currently C8H) to the I/O port with
address F1H.
6008 CD 00H CALL 5100
Jump to the memory location 5100H
51H
and execute the subroutine located
there. After executing the subroutine,
return to the instruction immediately
after this CALL
600B 3E 00H MVI A, 00
Load the immediate value 00H into
the accumulator (register A).
600D D3 F1H OUT F1 Send the contents of register A
(currently 00H) to the I/O port with
address F1H.
600F CD 00H CALL DELAY A, M
Jump to the memory location where
51H
the subroutine DELAY is defined and
execute it. Return after execution.
JNZ LOOP1
5105 C2 04 51 If the value in register C is not zero,
jump back to the LOOP1 label.
DCR B
5108 05 Decrease the value in register B by 1.
JNZ LOOP2
5109 C2 02 51 If the value in register B is not zero,
jump back to the LOOP2 label.
RET Return from the subroutine to the
510C C9
instruction following the CALL that
invoked it.
Data:
D7 D6 D5 D4 D3 D2 D1 D0
1 0 1 0 0 1 0 0
Result:
The status of LED’s of the mentioned port (port A) is per the sequence provided in the
program. i.e A4(10100100).
Conclusion: Using the 8051 microcontroller kit the flashing of LED To the port was
successfully performed.
Precautions:
1. Do not press any wrong key of the keyboard.
2. Feed the correct program.
3. Switch off the power supply after completing the experiment.
4. Do not touch any IC of the kit.