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

📄 startup.asm

📁 MC56F802BLDC 可以使用的算法 就是电机启动有点慢
💻 ASM
字号:
;*****************************************************************************
;*
;* Motorola Inc.
;* (c) Copyright 2000 Motorola, Inc.
;* ALL RIGHTS RESERVED.
;*
;******************************************************************************
;*
;* File Name: startup.asm
;*
;* Description: initial startup routine hooked to RESET vector,
;*              do necessery low level initialization before
;*              running C language routines 
;*
;* Target: DSP56F803/5 device
;*
;* Modules Included: C_compiler.def
;*
;*****************************************************************************

	include "C_compiler.def"
	
	ORG	P:


	SECTION Startup
	
	GLOBAL  FStart
	
	LOCAL   pll_lock
	LOCAL   init_vars
	LOCAL   skip_pll_lock
	
FStart:
	bfclr   #$0002,x:$0F30       ;disable COP
	bfclr   #$00ff,x:$FFF9       ;set 0 wait states
	move    #F_StackAddr,r0      ;init stack (definition in linker cmd file)
	nop
	move    r0,x:<mr15           ;for C compiler compatibility
	move    r0,sp
	
	move    #$11,x0              ;reset value of PLL Control Register
	cmp     x:$0FA0,x0           ;read PLL Control Register
	bne     skip_pll_lock        ;skip PLL setup in simulator mode
   
;PLL setup
	move    #$0081,x:$0FA0       ;PLL lock detector ON, core still on 8 MHz
	move    #$2013,x:$0FA1       ;80 MHz DSP core, 160 MHz VCO, 40 MHz bus

pll_lock:
	brclr   #$0040,x:$0FA2,pll_lock  ;test lock (LCK1)
                                 ;PLL locked
	move    #$0082,x:$0FA0       ;PLL lock detector ON, core on PLL clock

skip_pll_lock:
    move    #F_Xdata_start_in_ROM,r0  ;init global variables
	move    #F_Xdata_start_in_RAM,r1
	move    #F_Xdata_size,a
	tstw    a
	beq     init_vars1

init_vars:
	move    x:(r0)+,x0
	move    x0,x:(r1)+
    decw    a
	tstw    a
	bne     init_vars

init_vars1:
	move    #F_Xbss_start_in_RAM,r1    ;init bss variables
	move	#F_Xbss_size,a
	tstw	a
	beq		init_vars_end
	move	#0,y0

init_bss_vars:
	move	y0,x:(r1)+
    decw    a
	tstw    a
	bne     init_bss_vars
init_vars_end:    


    ; user defined function invoked before main()
    ; implementation in appconfig.c
	jsr     FuserPreMain
    
    ; jump to user program after init
    jsr     Fmain    
	
	; user defined function invoked after main()
    ; implementation in appconfig.c
	jmp     FuserPostMain

	ENDSEC
	

⌨️ 快捷键说明

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