MicroController Based Moving Message Display
MicroController Based Moving Message Display
MESSAGE DISPLAY
1. INTRODUCTION
We preferred to use 16 single digit alphanumeric displays over the LED dot-matrix
type since the former is much cost effective and has less programming burden
compared to other.
We have used Atmel’s AT89C51 microcontroller as the heart of the circuit along with
IC 74LS138 which is a 3to8 decoder, BC558 transistors, LED displays and power
supply unit in the circuit.
We have programmed to move the message from the rightmost display to the left and
the message stayed stationary for a few seconds when the first character reaches the
leftmost display, then it continues to move.
A 4 pin dip switch connected to the microcontroller through a port is used to select the
desired message stored in the memory of the microcontroller. The microcontroller
provides the data signal to the 16 display units through other two ports. Another port
is used to provide the address of the displays to the 3to8 decoders which are actually
controlling the turning on and off of the displays.
The report provides a brief idea about the project through the block diagram
explanation given in the first part. It is followed by a circuit diagram and circuit
description given in a nice manner. Then come the software part of the project, it
includes a software description, algorithm and finally the software code. The PCB
designs are provided in the final part of the report. Some random screenshots of the
software used for the program debugging and circuit simulation in also provided.
2. SYSTEM INFORMATION
LED Display
4 PIN
AT89C51
DIP
Microcontroller
Switch
Decoder
3. HARDWARE IMPLEMENTATION
The diagram above shows the circuit of the microcontroller based moving message
display. It comprises microcontroller AT89C51, three-to-eight decoder 74LS138,
common anode alphanumeric displays, regulator 7805 and a few discrete components.
Ports P0 and P2 of the microcontroller have been configured to act as a common data
bus for all the 16 alphanumeric displays whose corresponding data pins have been
tied together to make a common 16-bit data bus. Port-2 provides the higher byte of
data, while port-0 provides the lower one to light up a character on the display. Port
pins P1.2-P1.4 and P1.5-P1.7 of the microcontroller have been used as address inputs
for decoder IC3 and IC4 (74LS138) to enable one of the fourteen alphanumeric
displays (DIS3 through DIS16) at a time, respectively. However, displays DIS1 and
DIS2 are enabled or disabled directly by port pins P1.0 and P1.1. Pins 4 and 5 are
grounded and pin 6 is made high to enable decoder 74LS138.
previously stored messages using the 4-bit binary value present on these pins. This
value can be changed through a 4-pin DIP switch (S0 through S3).
Selection pins P3.4 through P3.7 are pulled high via resistors R36 through R33,
respectively. When the switch connected to a given pin is open the value is high (1),
and when it is closed the pin is held low and the value becomes ‘0.’ In this way, by
using a 4-bit number you can select any of the 16 messages stored in ROM
Capacitor C5 and resistor R37 form the power-‘on’ reset circuit, while a push-to-
connect switch has been used for manual reset. An 11.0592MHz crystal generates the
basic clock frequency for the microcontroller. To change the message being displayed
while the circuit is working, first change the number present at the selection bus, then
press ‘reset’ key.
We used software named Proteus 7 for simulating the working of our project,
especially the timer part. Some of the screenshots of the program is included here.
4. SOFTWARE IMPLEMENTATION
The software is written in assembly language and its main concept is as follows.
Timer 1 has been used to generate a delay of around 1 ms for the switching gap
between two consecutive displays. Thus, each display is enabled for 1 ms while
displaying a message. The length of this cycle depends upon the length of the
message string. The cycle repeats
after a ‘0’ is encountered at the end of each message stored in the look-up
table at the end of the program. Each time, to display a character at a given display,
first two bytes (16 bits) of data are sent to Port-2 and Port-0, then the desired display
is enabled by sending its address to Port-1. Thereafter,
a delay of 1 ms (slightly more than that) is generated by timer 1. Upon
timer overflow, the entire display panel is refreshed by passing ‘FFFFH’ to the data
bus. Then the next character at the next display is passed in the similar manner. The
cycle frequency is variable (depending upon the length of the message) but always
high enough so that the message appears continuous to the human eye. Timer 0, with
its interrupt enabled, is used to change the starting address of the message in cyclic
manner so that the characters scroll from left to right with a proper gap between each
shift. Meanwhile, the interrupt service sub-routine also checks for the starting address
of DIS16 (right-most display). As soon as the first character reaches DIS16, the
message stays for a longer time so that the entire message
(message length not longer than 16 characters) can be easily read. Thereafter,
characters again start scrolling rightwards, so the entire message goes out and
disappears after a while to reappear from left side.
All the messages are stored in the form of a look-up table in the program memory
(ROM) itself. When the circuit is switched ‘on’ (or reset), the monitoring program
first checks for the binary number present at the selection bus and according to that,
the ROM address of the starting character of the selected message is loaded into the
data-pointer. Thereafter, on-chip ROM reading is used to read the entire message over
there.
Each character is represented in the look-up table of the source code by two bytes. For
example, ‘S’ is represented by ‘Sh’ and ‘Sl’ separated by a comma. In addition to the
alphabets, Arabic numerals and a few special characters have been defined in the
program. For instance, a blank space is represented by ‘bsh, bsl.’ Thus, it is very easy
to modify the program.
We used software named Keil µVision 3 for building the target software and
debugging it. We could analyze each and every data bit in the ROM and RAM
throughout the program execution along with the states of all the 4 ports of the
microcontroller. We could also analyze the working of the timers according to the
written program. Some screen shots of the program is included here.
4.3 ALGORITHM
Move the data pointed by data pointer to port 2 and port 0 through
accumulator
Move the data ( address of displays ) pointed by R0 to port 1
Start timer 1 in mode 1 for generating a delay of 1ms ( delay between each
display )
When timer 1 overflows ( interrupts ) turn the display off and continue
Decrement R0
Increment data pointer, so that next character of message is loaded
Go back to Step A and repeat these steps until the accumulator = 0
If accumulator = 0, reload the data pointer with the base address of selected
message using registers R3 and R2 and go back to Step A
$mod51
Ah equ 0c2h
Al equ 9dh
Bh equ 82h
Bl equ 8dh
Ch equ 0afh
Cl equ 8dh
Dh equ 87h
Dl equ 8dh
Eh equ 0aah
El equ 8dh
Fh equ 0eah
Fl equ 9dh
GH equ 8dh
Gl equ 8dh
Hh equ 0c2h
Hl equ 0bfh
Ih equ 0bfh
Il equ 0c4h
Jh equ 0bfh
Jl equ 0b4h
Kh equ 6ch
Kl equ 0bfh
Lh equ 0afh
Ll equ 0afh
Mh equ 0c5h
Ml equ 0bbh
Nh equ 47h
Nl equ 0bbh
Oh equ 87h
Ol equ 8dh
Ph equ 0e2h
Pl equ 9dh
Qh equ 27h
Ql equ 9dh
Rh equ 62h
Sh equ 8ah
Sl equ 0cdh
Th equ 0ffh
Tl equ 0d4h
Uh equ 87h
Ul equ 0afh
Vh equ 57h
Vl equ 0fbh
Wh equ 87h
Wl equ 0aeh
Xh equ 7dh
Xl equ 7bh
Yh equ 0fbh
Yl equ 0fah
Zh equ 0bdh
Zl equ 4dh
org 0000h
sjmp main
sjmp a1
a4: mov r6,#10
mov r1,#41h
a1: setb tr0 ; set timer0 run bit
reti ;return from timer0 ISR and clear tf0
mov r0,#60h
blank: mov @r0,#0ffh ;initialize the pointed location by null address
dec r0
cjne r0,#2fh,blank
mov r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part of Microcontroller Based Moving Message Display. Not Actual
Size.
6. RESULT
The breadboard prototype of the circuit was made and tested for a single display. It
was verified by the guide. Then the circuit including the all display units was mounted
on PCB. The selected messages moved from the leftmost display to the right and it
stayed stationary for a few seconds, when the first character reached the leftmost
display. Thus the desired result was obtained.
7. CONCLUSION
It may be concluded that the mini project has helped us to develop a deep practical
knowledge of the at89c51 microcontroller. We have dealt with the timer programming
and the interrupt programming of the microcontroller. The LED displays proved to
very cost effective and simple to program compared to others. We could also use the
software like Proteus 7 and Keil µVision 3 that are very indispensible in embedded
software development.
8. FUTURE SCOPE
Many more messages would be possible if complete Port-3 is used for message
selection. Pins RxD, TxD, INT0 and INT1 have been kept free, so that these can be
used for interfacing with the serial port of the PC. Also, interrupt pins can be used to
display some message and sound an alarm in the case of an emergency. For example,
a fire sensor can be connected to ‘INT0’ and a vibration detector to ‘INT1.’ These
pins can also be used to send signals to synchronise a similar system that displays
another related message at the same time, so a 16-character, twoline display is made
possible.
9. REFERENCES
Websites
www.atmel.com
www.alldatasheets.com
APPENDIX