Sie sind auf Seite 1von 4

EXPERIMENT NO.

: 03

CREATE AND SIMULATE A PROGRM TO


DISPLAY 0-9 IN A 7 SEGMENT DISPLAY
USING MCU8051 IDE

AIM
Familiar with the MCU8051 simulator.

OBJECTIVES

1. Create a program to display 0-9 in a seven segment display.


2. Use virtual components in MCU8051 IDE to simulate the program.
3. Learn how to use software tools to 8051 development.

APPARATURS

1. Computer
2. MCU8051 IDE Software
PROCEDURE

1. 8051 IDE was started by clicking the shortcut on the desktop.


2. New project was started by following File → New
3. After saving the file with a proper name, the ALP to light the segments of the 7
Segment display was written. To do this one of the I/O ports (P1) was selected and
It's each bit were set 0 in order to display the required digit in the display.
4. A Seven Segment display was selected from the Virtual Hw menu and it was set to
common anode mode.
5. Then each segment of the SSD was connected properly to the Port#1 bits.
6. To keep a delay between the transition between two digits previous timer delay was
used with a less delay value.
7. Program was compiled by pressing F11 key.
8. Then the simulator in the IDE was started by pressing F2 and the program was
executed by pressing F9.
OBSERVATIONS

LST file of the program

                 1             ORG 0000H  ;ORG directive
                 2 
0000 7590C0      3     MAIN:   MOV P1,#11000000B  ;Display 0
0003 1134        4             ACALL DELAY  ;Start delay
0005 7590F9      5             MOV P1,#11111001B  ;Display 1
0008 1134        6             ACALL DELAY  ;Start delay
000A 759024      7             MOV P1,#0100100B  ;Display 2
000D 1134        8             ACALL DELAY  ;Start delay
000F 7590B0      9             MOV P1,#10110000B  ;Display 3
0012 1134        10             ACALL DELAY  ;Start delay
0014 759099      11             MOV P1,#10011001B  ;Display 4
0017 1134        12             ACALL DELAY  ;Start delay
0019 759092      13             MOV P1,#10010010B  ;Display 5
001C 1134        14             ACALL DELAY  ;Start delay
001E 759082      15             MOV P1,#10000010B  ;Display 6
0021 1134        16             ACALL DELAY  ;Start delay
0023 7590F8      17             MOV P1,#11111000B  ;Display 7
0026 1134        18             ACALL DELAY  ;Start delay
0028 759080      19             MOV P1,#10000000B ;Display 8
002B 1134        20             ACALL DELAY  ;Start delay
002D 759090      21             MOV P1,#10010000B ;Display 9
0030 1134        22             ACALL DELAY  ;Start delay
0032 80CC        23             SJMP MAIN  ;Jump to beginning
                 24 
0034 758901      25     DELAY:  MOV TMOD,#01H  ;Set Timer0 Mode1
0037 758CFD      26             MOV TH0,#0FDH  ;Set TH0#
003A 758AFD      27             MOV TL0,#0FDH  ;Set TL0#
003D D28C        28             SETB TR0  ;Start timer
003F 308DFD      29     LOOP:   JNB TF0,LOOP  ;Loop until timer 
;overflow
0042 C28C        30             CLR TR0  ;Stop timer
0044 C28D        31             CLR TF0  ;Clear overflow 
;bit
0046 22          32             RET  ;Return from delay
                 33             END ; End

Seven Segment Display Bit Configuration


DISCUSSION
Simulators provide a easy way of seeing how our ALP would work when loaded to a
micro controller without needing to have a actual micro controller. This also shows us how
internal memory and registers are manipulated during the program execution. This is not
possible with an actual Micro Controller. Thus a simulator help us to test and debug our
programs before downloading on to a micro controller and it also help us to study how the
micro controller functions.
MCU8051 IDE is a software tool that combines a editor, assembler, simulator and
several virtual I/O devices into a single software allowing easy testing and simulation of
assembly programs. It also supports many 8051 derivatives.
When using the simulator there is no need do declare the names TMOD, TH0 and
etc as we did when writing our ALP for AES-51 board. Those register names and ports can
be directly addressed with this familiar names. Another difference in the 8051 IDE and the
AES51 board is the starting locations of the programs. In AES51 we used 7000h as the
starting address, but here we have to use 0000h as the starting address.
Another thing to kept in mind when using this is that the program execution is done
slowly than a actual micro controller to facilitate viewing and understanding of the
execution and bugs in the program. So when testing real world programs in the simulator
we have to use small values for delays. Unless we may have to wait for very long periods
of times to observe the changes.

Das könnte Ihnen auch gefallen