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

📄 ncrt0.a30.bak

📁 该程序实现了三菱M16C/62单片机的三相马达控制用的定时功能
💻 BAK
字号:
;*************************************************************************** ;
; C COMPILER for M16C/60,20
; Copyright 2001 MITSUBISHI ELECTRIC CORPORATION
; AND MITSUBISHI ELECTRIC SEMICONDUCTOR APPLICATION ENGINEERING CORPORATION
; All Rights Reserved.
;
; ncrt0.a30 : NC30 startup program
;
; This program is applicable when using the basic I/O library
;       
; $Id: ncrt0.a30,v 1.14 2001/11/12 04:06:53 muranaka Exp $
;
; Updated by Paul Wright 23 Apr 2002 for use with Monitor V2 and KD30
;  
;***************************************************************************

;		.glb	__BankSelect
;__BankSelect	.equ	0BH
;---------------------------------------------------------------------
; HEEP SIZE definition
;---------------------------------------------------------------------
HEAPSIZE	.equ	300h			;定义堆的大小

;---------------------------------------------------------------------
; STACK SIZE definition
;---------------------------------------------------------------------
STACKSIZE	.equ	600h			;定义用户堆栈的大小

;---------------------------------------------------------------------
; INTERRUPT STACK SIZE definition
;---------------------------------------------------------------------
ISTACKSIZE	.equ	600h			;定义中断堆栈的大小

;---------------------------------------------------------------------
; INTERRUPT VECTOR ADDRESS  definition
;---------------------------------------------------------------------
;VECTOR_ADR 	.equ	0ffd00h
VECTOR_ADR 	.equ	0FFE00h			;可变中断矢量表的起始地址

;---------------------------------------------------------------
; special page definition
;---------------------------------------------------------------
;       macro define for special page
;
;Format:
;	SPECIAL	number
;

SPECIAL	.macro	NUM
	.org	0FFFFEH-(NUM*2)
	.glb	__SPECIAL_@NUM
	.word	__SPECIAL_@NUM  & 0FFFFH
.endm
;---------------------------------------------------------------------
; Section allocation
;---------------------------------------------------------------------
	.list OFF
	.include sect30.inc
	.list ON

;---------------------------------------------------------------------
; SBDATA area definition
;---------------------------------------------------------------------
	.glb	__SB__
__SB__	.equ	data_SE_top

;====================================================================
; Initialize Macro declaration
;---------------------------------------------------------------------
N_BZERO	.macro	TOP_ ,SECT_
	mov.b	#00H, R0L
	mov.w	#(TOP_ & 0FFFFH), A1
	mov.w	#sizeof SECT_ , R3
	sstr.b	
	.endm

N_BCOPY .macro	FROM_,TO_,SECT_
	mov.w	#(FROM_ & 0FFFFH),A0
	mov.b	#(FROM_ >>16),R1H
	mov.w	#TO_ ,A1
	mov.w	#sizeof SECT_ , R3
	smovf.b
	.endm

BZERO	.macro	TOP_,SECT_
	push.w	#sizeof SECT_ >> 16
	push.w	#sizeof SECT_  & 0ffffh
	pusha	TOP_ >>16
	pusha	TOP_ & 0ffffh
	.stk	8
	.glb	_bzero	
	.call	_bzero,G
	jsr.a	_bzero
	.endm


BCOPY	.macro	FROM_ ,TO_ ,SECT_
	push.w	#sizeof SECT_  >> 16
	push.w	#sizeof SECT_  & 0ffffh
	pusha	TO_ >>16
	pusha	TO_  & 0ffffh
	pusha	FROM_ >>16
	pusha	FROM_  & 0ffffh
	.stk	12
	.glb	_bcopy
	.call   _bcopy,G
	jsr.a	_bcopy
	.endm

;====================================================================
; Interrupt section start
;---------------------------------------------------------------------
	.insf	start,S,0
	.glb	start
	.section	interrupt
start:
;---------------------------------------------------------------------
; after reset,this program will start
;---------------------------------------------------------------------
	ldc	#istack_top,	isp	;set istack pointer
	mov.b	#03h,0ah		;enable PRC1 and PRC0 bits
;	bset	1,0ah
	mov.b	#0c0h,04h		;set processor mode 
	mov.b	#00h,05h
;	bclr	1,0ah
	mov.b	#48h,06h		;set to no division mode on main clock
	mov.b	#20h,07h
	mov.b	#00h,0ah		;disable PRC1 and PRC0 bits

	ldc	#0080h,	flg
	ldc	#stack_top,	sp	;set stack pointer 
	ldc	#data_SE_top,	sb	;set sb register 
	fclr	I
	ldintb	#VECTOR_ADR
	fset	I

;====================================================================
; NEAR area initialize.
;--------------------------------------------------------------------
; bss zero clear
;--------------------------------------------------------------------
	N_BZERO	bss_SE_top,bss_SE
	N_BZERO	bss_SO_top,bss_SO
	N_BZERO	bss_NE_top,bss_NE
	N_BZERO	bss_NO_top,bss_NO

;---------------------------------------------------------------------
; initialize data section
;---------------------------------------------------------------------
	N_BCOPY data_SEI_top,data_SE_top,data_SE
	N_BCOPY	data_SOI_top,data_SO_top,data_SO
	N_BCOPY	data_NEI_top,data_NE_top,data_NE
	N_BCOPY	data_NOI_top,data_NO_top,data_NO

;====================================================================
; FAR area initialize.						;远区,采用单片模式时,应屏蔽
;---------------------------------------------------------------------
; bss zero clear
;---------------------------------------------------------------------
;	BZERO	bss_FE_top,bss_FE
;	BZERO	bss_FO_top,bss_FO

;---------------------------------------------------------------------
; Copy edata_E(O) section from edata_EI(OI) section
;---------------------------------------------------------------------
;	BCOPY	data_FEI_top,data_FE_top,data_FE
;	BCOPY	data_FOI_top,data_FO_top,data_FO

;	ldc	#stack_top,sp
;	.stk	-40

;====================================================================
; heap area initialize
;---------------------------------------------------------------------
	.glb	__mbase
	.glb	__mnext
	.glb	__msize
	mov.w	#(heap_top&0FFFFH), __mbase
	mov.w	#(heap_top>>16), __mbase+2
	mov.w	#(heap_top&0FFFFH), __mnext
	mov.w	#(heap_top>>16), __mnext+2
	mov.w	#(HEAPSIZE&0FFFFH), __msize
	mov.w	#(HEAPSIZE>>16), __msize+2

;====================================================================
; Initialize standard I/O
;---------------------------------------------------------------------
;	.if _STANDARD_IO_==1
	.glb	_init
	.call	_init,G
	jsr.a	_init
;	.endif

;====================================================================
; Call main() function
;---------------------------------------------------------------------
	ldc	#0h,fb	; for debuger

	.glb	_main
	jsr.a	_main

;====================================================================
; exit() function
;---------------------------------------------------------------------
	.glb	_exit
	.glb	$exit
_exit:			   ; End program
$exit:
	jmp	_exit
	.einsf
;====================================================================
; dummy interrupt function
;---------------------------------------------------------------------
dummy_int:
	reit
	.end
;***************************************************************************
;
; C COMPILER for M16C/60,20
; Copyright 2001 MITSUBISHI ELECTRIC CORPORATION
; AND MITSUBISHI ELECTRIC SEMICONDUCTOR APPLICATION ENGINEERING CORPORATION
; All Rights Reserved.
;
;***************************************************************************

⌨️ 快捷键说明

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