c54_timer.asm

来自「该代码采用c5400dsp的汇编语言和c语言实现ucos操作系统」· 汇编 代码 · 共 34 行

ASM
34
字号
;
; _StartTimer sets up the the C549 Timer registers and enable the
; timer interrupts. It must be called after the OSStart(). Therefore
; the best place to call it is in the first user task.
;
		.def 		_StartTimer
		
		.mmregs
		
TCR_STOP	.set	0x001f
TCR_RUN		.set	0x002f
PRD_INIT	.set	0x3e7	;  together with TDDR, timer period 0x3e8*0x10/80MHz = 200us                        

		.text
		
_StartTimer: 
	
;----------------------------------
; Initialize Timer
;----------------------------------
	stm #TCR_STOP, TCR
	stm #PRD_INIT, PRD
	stm #TCR_RUN, TCR
	stm #0x200,	IMR	                          
	ldm IMR, A				; read the IMR
	add #8, A				; turn on the TINT bit
	stlm A, IMR				; write it back to IMR

    stm   #0x0,		IFR    ; Writing a 0 to an IFR bit,
                           ; clears the interrupt flag 
	nop;
	nop; 
                           
    ret;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?