📄 time.asm
字号:
.title "timer.asm"
.include "regs.asm"
.include "vector.asm"
; .include "sintab.asm"
; .include "atan.asm"
; .include "sig.asm"
.mmregs
.def main ;Must have
.data
stack_len .set 100
sysstack_len .set 100
stack .usect "stack",stack_len
sysstack .usect "stack",sysstack_len
****************************************
.text
main:
****************************************************************
* *
* INITIALIZING *
* *
****************************************************************
bset intm ;forbid the Maskable Interrupts for initialize
;关闭所有可屏蔽中断
bset c54cm ;54 compatible mode
.c54cm_on
bclr FRCT
;bset FRCT
;bclr SMUL
;bset SATD
bset M40
;bset RDM
bset SXMD ;extent the sign
;bset XF
; bset m40
** INITIALIZE STACK POINTER SP AND SSP **
amov #(stack+stack_len),xsp ;data stack point
mov #(sysstack+sysstack_len),ssp ;pragram stack point
** CLOCK **
mov #2312h,port(#CLKMD) ;144MHz
mov #0a5h,mmap(IVPH) ;This is the bits23-8 of Vector Address
mov #0a5h,mmap(IVPD) ;
mov #010h,mmap(IER0)
;mov #0h,mmap(IFR0)
** timer initialized **
mov 0x0430,port(#TCR0) ;timer output and Stop the timer
nop
mov 000fh,port(#PRSC0) ;TDDR -PSC
nop
mov 0008h,port(#PRD0) ;PRD -TIM
nop
mov 0x0020,port(#TCR0) ;Start the timer and over loading parameter
bclr intm ;打开所有可屏蔽中断
** wait **
wait:
nop
nop
nop
nop
nop
b wait
tint0_isr:
nop
nop
reti
no_isr: b no_isr
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -