?? time.asm
字號(hào):
********************************************************************************
* MEMORY.ASM v1.00 *
* 版權(quán)(c) 2003- 北京合眾達(dá)電子技術(shù)有限責(zé)任公司 *
* 設(shè)計(jì)者: 段立鋒 *
*********************************************************************************
.file "time.asm"
.c_mode
.mmregs
.copy "vc54x.inc" ; VC5402 Memory-Mapped Register Declaration
.copy "dec5416.inc" ; SEED DEC5416 Memory-Mapped Register Declaration
.def _boot_end
.ref _time_state
.def _time_isr
.def _time_start
.def _led_on
****************************************************************************
*定時(shí)器設(shè)置參數(shù) *
****************************************************************************
PRD_DATA .set 0ffffH ;the period of timer is 0.001s
TCR_START .set 0fcfH ;start the timer
.text
*********************************************************************************
* *
* 函數(shù)定義:void _led_on() *
* 功 能:;啟動(dòng)定時(shí)器 *
* *
* 入口參數(shù): 無(wú) *
* 出口參數(shù): 無(wú) *
* 資源使用:無(wú) *
* *
*********************************************************************************
_led_on: STM #_time_state,AR0
LD *AR0(1),A
STM #0,AH
AND #01,A
BC turn_on,AEQ
RSBX XF
B led_exit
turn_on: SSBX XF
led_exit: .if __far_mode
FRET
.else
RET
.endif
*********************************************************************************
* *
* 函數(shù)定義:void _time_start() *
* 功 能:;啟動(dòng)定時(shí)器 *
* *
* 入口參數(shù): 無(wú) *
* 出口參數(shù): 無(wú) *
* 資源使用:無(wú) *
* *
*********************************************************************************
_time_start: STM #PRD_DATA,PRD ;set the period of the Timer0
STM #PRD_DATA,TIM
STM #TCR_START,TCR ;start the timer
.if __far_mode
FRET
.else
RET
.endif
****************************************************************************
*定時(shí)器中斷服務(wù)程序,頻率為38Hz *
****************************************************************************
_time_isr: PSHM AL
PSHM AH
PSHM AR0
STM #_time_state,AR0
;取當(dāng)前的高電平計(jì)數(shù)值
LD *AR0(0),A
;計(jì)數(shù)值減一
STM #0,AH
BC reload,AEQ
SUB #1,A
STL A,*AR0(0)
B time_next
reload: STM #20h,AL
STL A,*AR0(0)
;設(shè)置標(biāo)志
LD *AR0(1),A
STM #0,AH
ADD #1,A
STL A,*AR0(1)
time_next: POPM AR0
POPM AH
POPM AL
POPM ST1
POPM ST0
RETE
b $
_boot_end: NOP
.end
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -