新聞中心

HOLTEK單片機(jī)-秒表

作者: 時(shí)間:2016-11-29 來源:網(wǎng)絡(luò) 收藏
功能說明:

利用定時(shí)器1的定時(shí)模式制作一個(gè)秒表

本文引用地址:http://m.butianyuan.cn/article/201611/323314.htm

電路說明:

HT48R50A-1 的端口A,端口C控制4個(gè)共陽極七段顯示器以顯示秒表的s及1/100s。

HT48R50A-1 的復(fù)位鍵SW1作為秒表的開始計(jì)時(shí),停止計(jì)時(shí)和回零按鍵。

程序:

; ***************************************************; * Filename : 9712a.ASM                            *; * Function : Stop watch                           *; * Microprocessor : HT48R50A-1/28SKDIP-A           *; * Crystal : 4MHz                                  *; ***************************************************#INCLUDE                HT48R50A-1.INCTIMER_START             EQU     55HTIMER_STOP              EQU     66H;----------------------------------------------------DATA    .SECTION        AT 60H  DATAWARM_RESET              DB      ?       ;[60H]DELAY_COUNTER           DB      ?       ;[61H]DISPLAY_DATA            DB      ?       ;[62H]DISPLAY_COUNTER         DB      ?       ;[63H]DISPLAY_SHIFT           DB      ?       ;[64H]SECOND                  DB      4 DUP(?);[65H];----------------------------------------------------CODE    .SECTION        AT 00H  CODEORG     00HJMP     STARTORG     0CHJMP     TIMER1ORG     20HSTART:CLR     PACCLR     PCCMOV     A,WARM_RESETSUB     A,TIMER_STARTSZ      ACCJMP     TIMER_STOP_CMOV     A,TIMER_STOPMOV     WARM_RESET,AJMP     TIMER_START_GOTIMER_STOP_C:MOV     A,WARM_RESETSUB     A,TIMER_STOPSZ      ACCJMP     TIMER_ONECLR     WARM_RESETJMP     DISPLAYTIMER_ONE:MOV     A,TIMER_STARTMOV     WARM_RESET,ACALL    CLEANJMP     DISPLAYTIMER_START_GO:MOV     A,09HMOV     INTC,AMOV     A,80HMOV     TMR1C,AMOV     A,0F0HMOV     TMR1L,AMOV     A,0D8HMOV     TMR1H,ASET     TMR1C.4CALL    CLEANTIMER:MOV     A,OFFSET SECONDMOV     MP1,AMOV     A,R1SUB     A,0AHSZ      ACCJMP     DISPLAYCLR     R1INC     MP1INC     R1MOV     A,R1SUB     A,0AHSZ      ACCJMP     DISPLAYCLR     R1INC     MP1INC     R1MOV     A,R1SUB     A,0AHSZ      ACCJMP     DISPLAYCLR     R1INC     MP1INC     R1MOV     A,R1SUB     A,06HSZ      ACCJMP     DISPLAYCALL    CLEANDISPLAY:MOV     A,OFFSET SECONDMOV     MP0,AMOV     A,0FEHMOV     DISPLAY_SHIFT,AMOV     A,04HMOV     DISPLAY_COUNTER,ADISPLAY_LOOP:MOV     A,R0MOV     TBLP,ATABRDL  DISPLAY_DATAMOV     A,DISPLAY_DATAMOV     PA,AMOV     A,DISPLAY_SHIFTMOV     PC,AINC     MP0RL      DISPLAY_SHIFTCALL    DELAYSDZ     DISPLAY_COUNTERJMP     DISPLAY_LOOPMOV     A,WARM_RESETSUB     A,TIMER_STOPSZ      ACCJMP     DISPLAYJMP     TIMERRET;----------------------------------------------------TIMER1:INC     SECONDRETI;----------------------------------------------------CLEAN           PROCMOV     A,OFFSET SECONDMOV     MP1,AMOV     A,04HMOV     DISPLAY_COUNTER,ACLEAN_LOOP:CLR     R1INC     MP1SDZ     DISPLAY_COUNTERJMP     CLEAN_LOOPRETCLEAN           ENDP;----------------------------------------------------DELAY           PROCMOV     A,0FFHMOV     DELAY_COUNTER,AWAIT:SDZ     DELAY_COUNTERJMP     WAITRETDELAY           ENDP;----------------------------------------------------ORG     0F00HDC      081H,0CFH,092H,086H     ;0123DC      0CCH,0A4H,0A0H,08FH     ;4567DC      080H,084H               ;89;----------------------------------------------------END 


關(guān)鍵詞: HOLTEK單片機(jī)秒

評(píng)論


技術(shù)專區(qū)

關(guān)閉