Scrolling Messg Display
-
Upload
ash43black -
Category
Documents
-
view
220 -
download
0
Transcript of Scrolling Messg Display
-
8/8/2019 Scrolling Messg Display
1/4
; 0B0H = PORT3 DIRECT ADDRESSD_BUS DATA 0B0H ; data bus ( PORT 3 )
; 90H = PORT 1 DIRECT ADDRESSA_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 bestable,
; 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 Displayclr RST ; Reset & Clear Displaysetb wracall delay2 ; No Read or Write for at least 3 clock cycles
; after Reset & Clearsetb RST ; Hold RST High for remainder of program
; Set Display Brightness
bright: clr a3 ; clr A3 to setup for brightness setmov D_BUS,#7; data to blank displayclr wr ; WR=LOWsetb wr ; WR=HIGH, data written to display on LOW to
HIGHmov D_BUS,#6; 13% brightness
-
8/8/2019 Scrolling Messg Display
2/4
clr wrsetb wrsetb 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 wantyour
; 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 loadajmp 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 RAMinc r0 ; increment to next RAM addressdjnz r5,ramclr ; if we havent BLANKED out 8 address's keep
going
fetch: acall getchr ; RAM BLANK done , get first character to bediplayed
halt: jz count2 ; if return value in ACC = decimal 0 start overmov r5,#8 ; number of display DIGITS available on HDSP-
2112mov r0,#20h; load beginning RAM address
doit: xch a,@r0 ; SWAP ACC data with display RAM datainc r0 ; increment to next RAM addressdjnz r5,doit; check if END of RAM location, if not keep
goingmov r0,#20h; again load first RAM addressmov r4,#7 ; address to select first digit
; ( far right ) on displayacall msgout ; send message digit to displayajmp fetch ; return to routine FETCH.
msgout: clr d_bus.7; re-enable displaymov 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
-
8/8/2019 Scrolling Messg Display
3/4
; 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 WILLSCROLL
; TO DIGIT 2 THE SECOND FROM THE LEFT FACINGTHE
; DISPLAY ).
msgout1: mov a,r4 ; load digit address for display digitselection
mov A_BUS,a ; select digit position on displaydec r4 ; 1st digit=7 ( right side of display )
decrement formov a,@r0 ; next, then load ACC with data to display.mov D_BUS,a ; move data to displayclr wr ; WRITE STROBE for displaysetb wr ; write data to display on LOW to HIGH
transition
inc r0 ; increment RAM pointer to next data digit fordisplay
djnz r5,msgout1 ; if not=8 total digits keep goingacall 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 digitclr a ; location ( MESSAGE ADDRESS ) in CODE space.movc a,@a+dptr; move CODE ( MESSAGE ) digit pointed to byret ; ACC+DPTR too ACC, and return to calling
routine.
power_down: mov 87h,#2 ; Set bit "PD" of the PCON Special FunctionRegister
; This will cause the controller to Power Down.
; routine DELAY2 sets the SCROLL SPEED, and will prevent a JERKYAPPEARANCE; 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,#00hdelay4: mov r3,#00hdelay5: djnz r3,delay5
djnz r2,delay4djnz r1,delay3retnop
; the number 0 will indicate the END of our message.
-
8/8/2019 Scrolling Messg Display
4/4
message: db ' Merry Christmas..............,'db ' And A Happy New Year..........',0
END