www.pudn.com > DPS2812_EXTAD.rar > system.asm


************************************************************************* 
*	filename:	system.asm 
*	designer:	戴展波 
*	date:		2004/12/16 
************************************************************************* 
 
		.file	"system.asm" 
		.copy	"f2812.inc" 
		 
		.def	_InitSysCtrl 
		.def	_KickDog 
		 
		.bss	pll_delay,1 
				 
		.text 
********************************************************************************* 
* 函数定义:void InitSysCtrl(void) 
* 
* 功    能:初始化系统											* 
*																				* 
* 入口参数:无	 
*												* 
* 出口参数:无	 
*										* 
* 资源使用:XAR6																* 
*																				* 
*********************************************************************************		 
_InitSysCtrl: 
	EALLOW 
	 
;	MOVW	DP,#11Fh 
	 
	;关看门狗 
	MOVL	XAR6,#WDCR 
	MOV	*XAR6,#68h	;disable watchdog 
	;MOV	*XAR6,#28h	;enable watchdog 
	 
	;10倍频PLL 
	MOVL	XAR6,#PLLCR 
	MOV	*XAR6,#10 
	 
	;延时5000个指令周期 
	MOVL	XAR6,#pll_delay 
	MOV	*XAR6,#5000 
	 
	RPT @pll_delay 
	|| NOP 
	 
	;sysclkout/2 
	MOVL	XAR6,#HISPCP 
	MOV	*XAR6,#1 
	 
	;sysclkout/4 
	MOVL	XAR6,#LOSPCP 
	MOV	*XAR6,#2 
	 
	;使能F2812片内模块的时钟 
	MOVL	XAR6,#PCLKCR 
	;CAN模块 
	;OR	*XAR6,#4000h 
	;MCBSP模块 
	;OR	*XAR6,#1000h 
	;SCIB模块 
	;OR	*XAR6,#0800h 
	;SCIA模块 
	;OR	*XAR6,#0400h 
	;SPI模块 
	;OR	*XAR6,#0100h 
	;ADC模块 
	OR	*XAR6,#0008h 
	;EVB模块 
	;OR	*XAR6,#0002h 
	;EVA模块 
	;OR	*XAR6,#0001h 
	 
	EDIS 
	 
	LRETR 
 
********************************************************************************* 
* 函数定义:void KickDog(void) 
* 
* 功    能:清看门狗										* 
*																				* 
* 入口参数:无	 
*												* 
* 出口参数:无	 
*										* 
* 资源使用:AR0																* 
*																				* 
********************************************************************************* 
_KickDog: 
	EALLOW 
	 
;	MOVW	DP,#11Fh 
	 
	MOVL	XAR6,#WDKEY 
	MOV		*XAR6,#55h 
	MOV		*XAR6,#0AAh 
	 
	EDIS 
	 
	LRETR