⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c54_timer.asm

📁 该代码采用c5400dsp的汇编语言和c语言实现ucos操作系统
💻 ASM
字号:
;
; _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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -