HOLTEK单片机-秒表
时间:11-29
来源:互联网
点击:
功能说明:
利用定时器1的定时模式制作一个秒表。
电路说明:
HT48R50A-1 的端口A,端口C控制4个共阳极七段显示器以显示秒表的s及1/100s。
HT48R50A-1 的复位键SW1作为秒表的开始计时,停止计时和回零按键。
程序:
; ***************************************************; * 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
HOLTEK单片机秒 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)