יום שישי, 27 במאי 2011

מיני פרויקט עם 7 SIGMENT

 פרויקט הודעה זזה





זאת הסכימה

את הצ'יפ פה ניתן להחליף ולהתשמש גם בAT80C4051 או 2051 זה לא כל כך משנה רק המהירות והזיכרון ישתנו בהתאם.
המעבד שלנו עובד על מתנד של 12 MHZ שבעצם קובע את קצב התנודות ואת קצב סיבובי המכונה.
יש כאן מעגל RESET ברגל 9.
כל PORT3 ו0 משמשים בתור יציאת DATA ל6 7SEG .



התוכנה מלווה בהסבר כל שורה(באנגלית) אם יש אי הבנה כלשהי תשאירו הודעה בתגובות

;                           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




החומרה כאן פשוטה מאוד 2/10
התוכנה גם פשוטה מאוד 2/10


תמונות מהפרויקט העובד

אין תגובות:

הוסף רשומת תגובה