Search Your Query

Custom Search

Monday 23 May 2011

Moving Message Display


This project uses the Phillips 87C750 microcontroller with an Agilent Technologies HDSP-2112, 8-Character, 5X7 Dot Matrix, Alphanumeric Programmable Display to create a marquee style moving message display. Your custom message scrolls by from right to left facing the display.
Note: I recently converted this project from 8051 assembly to PicBasic Pro for use with the PIC microcontroller if you prefer this route. Click HERE to see it in BASIC.
The circuit board was designed with the microcontroller located on the back of the circuit board leaving just the display and reset button on the front. This lets the unit be mounted on a hat or shirt pocket. Your message is hard coded into code space within the microcontroller. You can have several micros programmed with different messages, and just snap in another micro to change your message.
Replace those funky stick-on name badges at conventions, or class reunions. This is a great project for learning to use Intelligent Alphanumeric Displays in microcontroller designs.
I wear one of these on my hat to football games. If you do the same, take a bunch of them because everyone will want one.  I had one on my hat last year when I went to a Broncos game in Denver and was asked by at least three hundred people where I bought it.  It had a message ---- GO BRONCOS ---- scrolling across the front, I could have sold hundreds of them
The code for this project can easily be modified for any type microcontroller.
Where to find the parts to build this project.
For the display search for HDSP-2112
For the microcontroller search for 87C750
The displays are pretty expensive, but they are excellent, and easy to use.  Here is the datasheet for the HDSP-2112 display.  ClickHERE
Get the schematic & code:

bullet
To view the schematic left click Here.
bullet
To download the code for this project click Here.
Below is the code for this project showing how simple it is to control the HDSP-2112 display.  Notice at the bottom how the message is coded into code space using the db statement.   Although the code for this particular project was written for the 87C750 microcontroller, it would be simple to modify for any micro.  The Atmel AT89C2051 would be a good choice since it's a FLASH based controller and would make it very easy to change your message.
Another option would be to store your message in EEPROM.



; File Name C750DSP.ASM
; Single Message, Moving Message Display

; *************** USE METALINKS (( ASM51.EXE )) TO ASSEMBLE *****************
;
; ************ THIS ASSEMBLER WILL CREATE A ( HEX ) FILE **************

; 0B0H = PORT3 DIRECT ADDRESS
D_BUS DATA 0B0H ; data bus ( PORT 3 )

; 90H = PORT 1 DIRECT ADDRESS
A_BUS DATA 90H ; address bus ( PORT 1 ),A0=P1.0,A1=P1.1,A2=P1.2

; 80H.0 = PORT 0 BIT 0 ( PORT0 BIT ADDRESS )
WR BIT 80H.0; WR signal. to write to display A_BUS,data must be stable,
; then WR is brought LOW, data is written on LOW to HIGH
; transition of WR. so we then bring WR to HIGH to write.
; PORT 0 BIT 1 DIRECT BIT ADDRESS


A3 BIT 80H.1; clear for brightness set, then set and leave set.
; to set brightness send the following out to the data D_BUS.
; MSD-LSD 0=100% 1=80% 2=53% 3=40% 4=27% 5=20% 6=13% 7=blank

RST BIT 80h.2; Display Reset

;***************************************************************************
;* FIRMWARE For Control Of The HDSP-2112 Display *
;* A MOVING MESSAGE DISPLAY *
;* FOR THE PHILLIPS 87C750 MICROCONTROLLER *
;***************************************************************************

org 0 ; Establish Reset Vector at 0

; Routine to Reset Display on Power-Up

clr D_BUS.7; Enable Display
clr RST ; Reset & Clear Display
setb wr
acall delay2 ; No Read or Write for at least 3 clock cycles
; after Reset & Clear
setb RST ; Hold RST High for remainder of program

; Set Display Brightness


bright: clr a3 ; clr A3 to setup for brightness set
mov D_BUS,#7; data to blank display
clr wr ; WR=LOW
setb wr ; WR=HIGH, data written to display on LOW to HIGH
mov D_BUS,#6; 13% brightness
clr wr
setb wr
setb a3 ; transition of WR pin, then we leave A3 set for the
; remainder of the program, as it is ONLY used to
; tell the display we want to set BRIGHTNESS.

count: mov r7,#4 ; Load R7 with the number of times+1 you want your
; message to be displayed before power down.
; a 4 here will play the message 3 times etc...

count2: djnz r7,load ; Decrement counter, if not=zero goto load
ajmp power_down ; else power down.

load: mov dptr,#message-1 ; load message address -1

begin: mov r0,#20h; beginning RAM address for storage + manipulation
mov r5,#8 ; #8=indicator of how many DIGITS the HDSP-2112 has
mov a,#20h ; ASCII equivalent of a BLANK space on display.

ramclr: mov @r0,a ; load ASCII BLANKS in display RAM
inc r0 ; increment to next RAM address
djnz r5,ramclr ; if we havent BLANKED out 8 address's keep going

fetch: acall getchr ; RAM BLANK done , get first character to be diplayed

halt: jz count2 ; if return value in ACC = decimal 0 start over
mov r5,#8 ; number of display DIGITS available on HDSP-2112
mov r0,#20h; load beginning RAM address

doit: xch a,@r0 ; SWAP ACC data with display RAM data
inc r0 ; increment to next RAM address
djnz r5,doit; check if END of RAM location, if not keep going
mov r0,#20h; again load first RAM address
mov r4,#7 ; address to select first digit
; ( far right ) on display
acall msgout ; send message digit to display
ajmp fetch ; return to routine FETCH.

msgout: clr d_bus.7; re-enable display
mov r5,#8 ; load number of digits our display has for use.
; notice here with R5 holding the starting value
; of 8, that this allows the routine MSGOUT1 to
; decrement R4 8 times. R4 originally holds the
; address for digit #8, or the ( RIGHT MOST )
; digit on our display. By decrementing R4
; we move the display digit ( ADDRESS ) from
; digit to digit.
; or from digit 8 to digit 1, from RIGHT TO LEFT
; as seen facing the display.
; NOTE:( IF WE CHANGE R5 TO 7 THE DISPLAY WILL SCROLL
; TO DIGIT 2 THE SECOND FROM THE LEFT FACING THE
; DISPLAY ).

msgout1: mov a,r4 ; load digit address for display digit selection
mov A_BUS,a ; select digit position on display
dec r4 ; 1st digit=7 ( right side of display ) decrement for
mov a,@r0 ; next, then load ACC with data to display.
mov D_BUS,a ; move data to display
clr wr ; WRITE STROBE for display
setb wr ; write data to display on LOW to HIGH transition
inc r0 ; increment RAM pointer to next data digit for display
djnz r5,msgout1 ; if not=8 total digits keep going
acall delay2 ; delay to prevent JERKY look between digit updates.
; and to set our display ( SCROLL SPEED ).
ret ; return to calling routine.

getchr: inc dptr ; increment DPTR to point to next display digit
clr a ; location ( MESSAGE ADDRESS ) in CODE space.
movc a,@a+dptr; move CODE ( MESSAGE ) digit pointed to by
ret ; ACC+DPTR too ACC, and return to calling routine.

power_down: mov 87h,#2 ; Set bit "PD" of the PCON Special Function Register
; This will cause the controller to Power Down.


; routine DELAY2 sets the SCROLL SPEED, and will prevent a JERKY APPEARANCE
; between display digit updates. by changing the value first loaded into
; R1 in the first line to a lower number the scroll speed is faster, and by
; changing it to a higher number the scroll speed will be slower.

delay2: mov r1,#2
delay3: mov r2,#00h
delay4: mov r3,#00h
delay5: djnz r3,delay5
djnz r2,delay4
djnz r1,delay3
ret
nop


; the number 0 will indicate the END of our message.

message: db ' Merry Christmas..............,'
db ' And A Happy New Year..........',0



END

The pins on the HDSP-2112 are almost needle like and make it easy to push the pins through a hat or shirt pocket.  Notice in the last code segment how the message begins at the message: line.   Everything between the db and ending 0 will be shown in the scrolling message.  The indicates the end of the message and returns a null value.   Your message length is limited only to the amount of available code space in whatever microcontroller you chose to use for this project.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...