KS Project Manual eFY aPril 2009

Microcontroller-Based Moving-Message display


ED-based moving-message displays are becoming popular for transmitting information to large groups of people quickly. These can be used indoors or outdoors. We can find such displays in areas like railway platforms, banks, public offices, hotels, training institutes, nightclubs and shops. Compared to LEDs, liquid-crystal displays (LCDs) are easy to interface with a microcontroller for displaying information as these have many built-in functions. But these can’t be observed from a distance and largesize LCDs are very costly. LED-based displays can be of two types: dot-matrix and segmental. If you implement a moving-message display with multiplexed dot-matrix LEDs, it will be very costly for displaying 16 characters or more at a time. Moreover, programming will require a lot of data memory or program memory space. An external RAM may be needed to complement a microcontroller like AT89C51. However, if you use alphanumeric (16-segment LED) displays for the above purpose, programming burden is reduced and also it becomes highly cost-effective. You can make your own display panel consisting of 16 alphanumeric characters at a much lower cost. The circuit presented here uses 16 common-anode, single-digit, alphanumeric displays to show 16 characters at a time. Moreover, programming has been done to make the characters move in a beautiful manner. A message appears on the panel from the right side, stays for a few seconds when the first character reaches the leftmost place and then goes out from the left side. It displays 16 different messages to depict different occasions, which can be selected by the user through a DIP switch.

circuit description
Fig. 1 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. At the heart of the moving-message display is Atmel AT89C51 microcontroller (IC1). It is a low-power, high-performance, 8-bit microcontroller with 4 kB of flash programmable and erasable read-only memory (PEROM) used as on-chip program memory, 128 bytes of RAM used as internal data memory, 32 individually programmable input/output (I/O) lines divided into four 8-bit ports, two 16-bit programmable timers/counters, a five-vector two-level interrupt architecture, on-chip oscillator and clock circuitry. Parts List
Semiconductors: IC1 - AT89C51 microcontroller IC2, IC3 - 74LS138 3-to-8 decoder IC4 - 7805 5V regulator T1-T16 - BC558 pnp transistor D1-D4 - 1N4007 rectifier diode DIS1-DIS16 - KLA51 common-anode alphanumeric display LED1 - 5mm LED Resistors (all ¼-watt, ±5% carbon): R1-R16 - 2.2-kilo-ohm R17-R32 - 120-ohm R33-R37 - 10-kilo-ohm R38 - 220-ohm Capacitors: C1, C2 C3 C4 C5 C6 33pF ceramic disk 2200µF, 25V electrolytic 1µF, 16V electrolytic 10µF, 16V electrolytic 0.1µF ceramic disk

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. Fig. 2 shows the pin configuration of the common-anode alphanumeric display. All the corresponding data pins DIS1 through DIS16 of alphanumeric displays have been tied together,

List of Messages Which can be Selected
S3S2S1S0 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Message selected Happy Birthday Happy New Year *Happy Diwali* Merry Christmas *Happy Holi* *Eid Mubarak* Happy Dashehra Happy Wedding Happy Janmashtmi *Happy Rakhi* *Happy Pongal* Happy Mothers Day *Happy Ramjan* *Happy Lohri* *Happy Easter* Welcome to All

Miscellaneous: X1 - 220V AC primary to 9V, 500mA secondary transformer XTAL - 11.0592MHz crystal S0-S3 - 4-pin DIP switch S4 - Push-to-‘on’ switch

KS Project Manual eFY aPril 2009 Fig. 1: Circuit for microcontroller-based moving-message display .

by using a 4-bit number you can select any of the 16 messages shown in the Table. 4: Component layout for the PCB shown in Fig. first change the number present at the selection bus. respectively. 2: Pin configuration of alphanumeric display while the common anode of each display is separately powered via a BC558 transistor which switches ‘on’ or ‘off’ as required. Selection pins P3. 500 mA. so as to configure 16 alphanumeric displays. When the switch connected to a given pin is open the value is high (1).0 and P1. and when it is closed the pin is held low and the value becomes ‘0. The output of the transformer is rectified by a full-wave bridge rectifier comprising diodes D1 through D4. You need to use an additional PCB as shown in Fig. Component layout for this PCB is shown in Fig. 3: Actual-size. except alphanumeric display and associated components Fig.4 through P3. while a push-to-connect switch has been used for manual reset. then press ‘reset’ key. singleside PCB layout for the microcontroller-based moving-message display circuit.1 of IC1. construction Fig. Cor- . This value can be changed through a 4-pin DIP switch (S0 through S3). transistors T1 through T16 and resistors R17 through R32. 3 regulated power supply. single-side PCB for the microcontroller-based moving-message display circuit. Capacitor C4 bypasses any ripple present in the Fig. filtered by capacitor C3 and then regulated by IC 7805 (IC4).’ In this way. 4. 3 shows an actual-size. 6.0592MHz crystal generates the basic clock frequency for the microcontroller.7 are pulled high via resistors R36 through R33. through outputs of 74LS138 ICs and pins P1. LED1 acts as the power-‘on’ indicator.7) is used as a selection bus to select one of the 16 previously stored messages using the 4-bit binary value present on these pins. Capacitor C5 and resistor R37 form the power-‘on’ reset circuit. 5 shows the PCB for displays DIS1 through DIS8. Component layout for this PCB is shown in Fig.4 through P3. except displays DIS1 through DIS16. 5 for DIS9 through DIS16. the corresponding components will be transistors T9 through T16 and resistors R25 through R32 in addition to displays DIS9 through DIS16. The higher nibble of port P3 (P3.KS Project Manual eFY aPril 2009 Fig. For this PCB. transistors T1 through T8 and resistors R17 through R24. An 11. Fig. To change the message being displayed while the circuit is working. The 220V AC mains is stepped down by transformer X1 to deliver the secondary output of 9V.

a delay of 1 ms (slightly more than that) is generated by timer 1. 5: Actual-size. 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. on-chip ROM reading is used to read the entire message over there. Thereafter. For exam- . When the circuit is switched ‘on’ (or reset). As soon as the first character reaches DIS16. 3 are connected to CON2. respectively.asm’ is written in Assembly language and assembled using cross-compiler. the entire display panel is refreshed by passing ‘FFFFH’ to the data bus. 3 are connected to CON2. 5. 6: Component layout for the PCB shown in Fig. the message stays for a longer time so that the entire message (message length not longer than 16 characters) can be easily read. 5. 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. It is wellcommented and easy to understand. Note that each character is represented in the look-up table of the source code by two bytes. Connectors CON3. 5 responding connector are provided to make a proper connection. Connectors CON2. single-side PCB for alphanumeric display Fig. Upon timer overflow. Thereafter. Thereafter. through external wires to interface DIS1 through DIS9. through external cable to interface DIS9 through DIS16. first two bytes (16 bits) of data are sent to Port-2 and Port-0. CON5 and CON7 of Fig. characters again start scrolling rightwards. All the messages are stored in the form of a look-up table in the program memory (ROM) itself.KS Project Manual eFY aPril 2009 Fig. respectively. to display a character at a given display. CON4 and CON6 of Fig. Meanwhile. Timer 0. Thus. Timer 1 has been used to generate a delay of around 1 ms for the switching gap between two consecutive displays. CON4 and CON6 of Fig. 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. then the desired display is enabled by sending its address to Port-1. each display is enabled for 1 ms while displaying a message. with its interrupt enabled. so the entire message goes out and disappears after a while to reappear from left side. software and its working The source code ‘movmsg. The length of this cycle depends upon the length of the message string. the interrupt service sub-routine also checks for the starting address of DIS16 (right-most display). the ROM address of the starting character of the selected message is loaded into the data-pointer. CON4 and CON6 of Fig. the monitoring program first checks for the binary number present at the selection bus and according to that. Each time. Then the next character at the next display is passed in the similar manner.

#00h setb ea interrupt bit setb et0 . Ol.a1 mov r7. Oh. Still.#46 cjne r1.for star sign (asequ 17h equ 0ebh . bsh. Sl. fourh.minus sign equ 0ffh equ 3fh .reload timer0 with initial count djnz r7. Delete the old string and write the new string as below: msg0: db Hh. Also.** codes for decimal digits are given below: .underscore sign equ 0ffh equ 0ffh . Uh.’ These pins can also be used to send signals to synchronise a similar system that displays another related message at the same time.a2 .set global . interrupt pins can be used to display some message and sound an alarm in the case of an emergency. so that these can be used for interfacing with the serial port of the PC.a5 . Hh. Ol. INT0 and INT1 have been kept free. El.KS Project Manual eFY aPril 2009 ple. .** codes for alphabets are given below: Ah equ 0c3h Al equ 0e8h Bh equ 0bh Bl equ 0ebh Ch equ 3fh Cl equ 0e8h Dh equ 03h Dl equ 0efh Eh equ 2bh El equ 0e8h Fh equ 0ebh . Hl.timer0 interrupt vector address clr tr0 .#60h. 0 (Please note that the assembler is case-insensitive. open the source code in the editor. msh.clear timer0 run bit mov tl0. ‘l’ to lower one) zeroh equ 17h zerol equ 0e8h oneh onel twoh twol equ 0d7h equ 0ffh equ 23h equ 0ech threeh equ 2bh threel equ 0fch fourh fourl fiveh fivel sixh sixl equ 0c3h equ 0fbh equ 0bh equ 0f8h equ 0bh equ 0e8h org 0000h sjmp main org 000bh . fourl. ADB equ p1 . (‘h’ refers to higher byte.for micro (mu) equ 0ebh .) Future enhancements Many more messages would be possible if complete Port-3 is used for message selection.** codes for few special characters: strh terisk) strl plsh plsl mnsh mnsl _h _l bsh bsl pieh piel mueh muel equ 0e8h .#00h mov th0. TxD. Pins RxD. twoline display is made possible. bsl. Hl. oneh.’ First.a1 inc r1 sjmp a1 a4: mov r6.#10 mov r1.check to again start entering from left-side sjmp a4 a5: cjne r1. Ul. msl. onel.set timer0 run bit reti . bsl.asm $mod51 DBH equ p2 Bus DBL equ p0 . ‘S’ is represented by ‘Sh’ and ‘Sl’ separated by a comma.#41h a1: setb tr0 .check for display to stay on reaching display-16 sjmp a3 a2: inc r1 sjmp a1 a3: djnz r6. Arabic numerals and a few special characters have been defined in the program. Higher byte of Data Lower byte of Data Bus Address Bus message select input Fl equ 0e8h GH equ 1bh Gl equ 0e8h Hh equ 0c3h Hl equ 0ebh Ih equ 0ffh Il equ 9fh Jh equ 17h Jl equ 0ffh Kh equ 0ech Kl equ 0ebh Lh equ 3fh Ll equ 0ebh Mh equ 0d5h Ml equ 0e3h Nh equ 0d6h Nl equ 0e3h Oh equ 17h Ol equ 0e8h Ph equ 0e3h Pl equ 0e8h Qh equ 06h Ql equ 0e8h Rh equ 0e2h Rlw equ 0e8h Sh equ 0bh Sl equ 0f8h Th equ 0ffh Tl equ 9ch Uh equ 17h Ul equ 0ebh Vh equ 0fdh Vl equ 6bh Wh equ 17h Wl equ 0abh Xh equ 0fch Xl equ 77h Yh equ 0e3h Yl equ 0bbh Zh equ 3dh Zl equ 7ch .’ Thus. Nl. For example.enable sevenh equ 0d7h sevenl equ 0fch eighth equ 03h eightl equ 0e8h nineh ninel equ 03h equ 0f8h . a fire sensor can be connected to ‘INT0’ and a vibration detector to ‘INT1. a blank space is represented by ‘bsh. Oh.#00h . bsh.#50h. so a 16-character.for ‘+’ sign equ 9fh equ 0ebh . zerol.for pie equ 7fh equ 0e3h . upper and lower cases have been used for clarity. input equ p3 . Nh.blank space equ 0ffh equ 0eah . movmsg. it is very easy to modify the program. Eh.return from timer0 ISR and clear tf0 main: mov ie. In addition to the alphabets. bsl. Sh. zeroh. Suppose you want to display “HOUSE NO 401-H” in place of message ‘0. For instance.

bsh.Al.Yh .Th.Hh.@a+dptr jz down mov DBH.Hl.Ll.Yh.#9fh.Nl.Ph.Dl.Rh.#msg0 .Ll.Mh.Al.timer0 conchk2: cjne a.Hh.Al.Mh.bsl .Ah.Eh .bsh.Hl.Ih.#msg13 sjmp read chk14: mov dptr.bsh.#0f3h Display mov 46h.Rlw.bsl.Ah.Rlw.Yl.Dl.El.strl.Al.strl. Ih.Yl.Hl.strl.address for 15th .chk14 mov dptr.Yh .bsl.Lh.Hl.Hh.#msg12 sjmp read chk13: cjne a.Pl.Nh.bsl.strh.#msg9 sjmp read chk10: cjne a.El.bs h.Yh.bsh.Gl.Ah.Rlw .strl.El.Pl.Sh.Al.Ph.address for 10th .bsl .Mh.Rh.Hl.Yl.bsh. Yh.bsl.Hh.Dh.Ph.Ah.Tl.El.#msg3 sjmp read chk4: cjne a.#0fbh Display mov 48h.chk7 mov dptr.Pl.bsl.Dh.bsh.Sh.Kh.Dl.Al.El. Oh.Nl.Ml.Al.Lh. strl.bsh.#00h mov tl0.bsh.Hl.bsl.A l.Pl.#0ffh ret .0 msg3: db Mh.Mh.bsh.#msg4 sjmp read chk5: cjne a.Ah.Ah.#msg10 sjmp read chk11: cjne a.a clr a inc dptr movc a.Al.Pl.Ph.Dl.Al.El.Rlw.Pl.Pl.Pl.chk12 mov dptr.Rh.Tl. Ah.Eh.chk1 mov dptr.Jl.Hh.Al.Yl.Ol.0 msg10: db strh.address for 5th .Lh.#5fh Display mov 4bh.Pl.#0cfh.Ih.bsl.load addresspointer with initial address mov 50h.Yl.Rlw.set mode 1 for timer1 mov th1.0 msg7: db Hh.Ph.Ph.chk4 mov dptr. strl.Ol. Ih.Al.Hl.** look-up table starts from here: msg0: db Hh.0 msg12: db strh.Ph. now start reading chk0: cjne a.Pl.#0feh Display (leftmost) .address for 8th .Ol.bsh.Yh.Hh.bsh.Al.Ol.Dh.Hl.Ll.Nh.Y h.Sl.Ph.Sh.chk10 mov dptr.#10h .Ph.#0e7h Display mov 43h.Hl.bsh.#msg14 sjmp read read: mov r3.chk5 mov dptr.bsl.#1fh Display mov 49h.01h rd2: clr a movc a.0 msg11: db Hh.Pl. mov r0.address for 1st chk: mov a.Ah.#0dfh.Jl.Rlw.Pl.Ph.bsh.Ah .0 default: db Wh.Ll.bsh.bsl.Rh.Wl.Tl.Th.address for 11th .Wl.input .address for 7th .El.r2 .Ol.Pl.bsl.Wl.#7fh.Yl.Rh.Th.Gh.Pl.#0fch .Dh.bsh.0592MHz Xtal mov tl1.Yh.bsl.address for 6th .Ml.bsl.Yh.bsh.address for 3rd .Bh.Hh.Tl.Pl.Il.Rlw.bsl.Ah.initialize the pointed location by null address dec r0 cjne r0.bsh.bsl.bsh.Pl. Ah.#00h mov th0.Ml.Rlw.Ll.Hl.$ .Ah.bsh.Yl.Mh.Kl.Hl.Hh .bsl.Pl.bsh.0 msg9: db strh.Eh.Sh.Ih .Lh.bsl.Hh.bsh.#msg8 sjmp read chk9: cjne a.strl.#9fh Display mov 4dh.#msg5 sjmp read chk6: cjne a.Ph.Ah.Hl.Yl.Bh.0 msg2: db strh.Jh.Al.Ml. Ah.Ch.O h.a mov ADB.r3 .Il.bsl.Pl.Ph.bsl.mask lower nible to get selection bus value cjne a.#60h blank: mov @r0. now start reading chk1: cjne a.strl.Al.#0afh.Pl.bsh.bsh.Ih.Ph.Ph.Jh.bsl.address for 4th .Rh.FC66H will generate a delay of 1ms with 11.address for 14th .Eh.Ph.Wl.El.#10 .Al.Nh.@r0 acall timer dec r0 inc dptr sjmp rd2 down: mov dph.Rlw.address for 9th .#0ffh.Al.Ml.Ll.Ph.Ph.Ah.Dl.Yh.Hl.bsh.strh.strl.Hh.strl.Ph.Pl.Ah.Ah.Oh.0 msg5: db strh.chk8 mov dptr.Tl.Dl.Il.Kl.Il.#msg11 sjmp read chk12: cjne a.chk3 mov dptr.Nh.Ah.Mh.Ih.Ih.Ph.@a+dptr mov DBL.load dptr with starting address of msg0 sjmp read .#1fh.load dptr with starting address of defalt message sjmp read .Al. Yh.Rh.Hl.Ah.provides gap .bsh.Ph.El.#41h .#6fh.0 msg1: db Hh.#01h figured in mode 1 mov tcon.reload dph mov dpl.Tl.strl.Hh.Yl.Sl.Ph.Rh. Ah.Hh.Ah.0 msg8: db Hh.El.Yh.Hl.0 msg13: db strh.Rh.bsh.Sl.Il.Dh.bsl.Sl.Dl.#0fh.#0f7h Display mov 47h.#7fh Display mov 4ch.Uh.Ah.Yl.load accumulator with value at P3 orl a.Al.chk13 mov dptr.Ph.Hl.Mh.Hh.Cl.blank mov r1.#66h setb tr1 jnb tf1.dph mov r2.Sl.Rh.address for 12th .#0ffh .#46 between each shift mov r6.Hh.bsl.chk0 mov dptr.Hh.Rh.Al.#3fh.Nl.Al.Yh.Hl.Yl.bsh. Ah.Yl.Oh.set initial .Bl.Dh.0 end  .Hl.bsl. Oh.Hl.bsl.Rlw.Lh.bsl.Pl.Yl.Gl.chk11 mov dptr.#msg2 sjmp read chk3: cjne a.Wh.Yl.Eh. strl.#3fh Display mov 4ah.Th.Eh. Ah.chk9 mov dptr.strh.#0dfh Display (rightmost) mov 4fh.Sh.Ah.Il.bsl.#msg6 sjmp read chk7: cjne a.bsh.reload dpl sjmp rd1 timer: mov tmod.Nh.Ph.bsh.Th.Al. Ah.O l.0 msg6: db Hh.Y h.KS Project Manual eFY aPril 2009 timer0 interrupt mov tmod.Wh.#0e3h Display mov 42h.strh.#00h count to 0000H mov r7.#0fdh Display mov 41h.Pl.#0bfh.#default .Lh.bsl.bsh.Il.strl.strh.Ph.0 msg14: db strh.Il.Hl.#0bfh Display mov 4eh.Ph.Rh.bsl.Rlw .Sl.#8fh.#msg7 sjmp read chk8: cjne a.Pl.Ul.Yh.Pl.Ml.Al.Eh.address for 2nd .strl.Cl.Ph.chk6 mov dptr.Lh.0 msg4: db strh.address for 16th .wait until timer1 overflows clr tr1 clr tf1 mov DBH.Wh.Th.Al.chk2 mov dptr.Hl.strl.Al.Dh.Ah.#2fh.Ll.strl.Hh.Ih. strh.Nl.bsh.Yh .address for 13th .#0ebh Display mov 44h.bsh.dpl setb tr0 rd1: mov r0.Ml. strh.#0ffh mov DBL.Yl.bsh.Eh.Ah. Sh.Al.Ml.Al.Pl.Yl.bsl.Pl.#msg1 sjmp read .Ih.Eh.Eh.Y h.Al.Pl.Il.Yl.Ch.bsh.E l.Al.Eh.bsl.Ph.Hl.#2fh.Bl.Nl.Kh.Ah.Al.#0efh Display mov 45h.Oh.#4fh.bsl.Rlw.#5fh. Ah.bsl.Gh.Il.bsl.#0fh .bsl.strh.

Sign up to vote on this title
UsefulNot useful