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

📄 startup_i0.a30

📁 一个瑞萨单片机的程序。。。供大家学习用。。。。。。。。。。。。。。。。。。
💻 A30
字号:
;""FILE	COMMENT""**************************************************************
;  System Name : for eduction (NO TRANSFERRING)
;  File	Name   : startup_i0.a30
;  Contents    : startup program
;              : (for OAKS8-LCDBoard, not support library but support interrupt)
;  Model       : for OAKS8-LCD Board
;  CPU	       : R8C/Tiny series
;  Compiler    : NC30WA	V.5.30 Release 1
;  OS	       : not be used
;  Programer   : RENESAS Semiconductor Training Center
;  Note	       : for OAKS8-R5F21114FP(R8C/11 group,20MHz)
;******************************************************************************
; COPYRIGHT(C) 2004 RENESAS TECHNOLOGY CORPORATION
; AND RENESAS SOLUTIONS	CORPORATION ALL	RIGHTS RESERVED
;******************************************************************************
; History      : ---
;""FILE	COMMENT	END""*********************************************************

;==============================================================================
; section assign
;==============================================================================
        .include	sect_i0.inc		; section defination file
;==============================================================================
; SFR section definition for M16C/60 series 
;==============================================================================
        .include	target.inc		; for R8C/Tiny series
									; SFR section definition file 
;==============================================================================
; define macro
;==============================================================================
;-------------------------------------------------------------------------------
; define macro to clear section for static variable without initial value with 0
;-------------------------------------------------------------------------------
N_BZERO	.macro	TOP_ ,SECT_
	mov.b	#00H, R0L
	mov.w	#(TOP_ & 0FFFFH), A1
	mov.w	#sizeof	SECT_ ,	R3
	sstr.b	
	.endm
;-------------------------------------------------------------------------------
; define macro to transfer initial value to section for static variable with initial value
;-------------------------------------------------------------------------------
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
;==============================================================================
; start up program section
;==============================================================================
	.section	startup			; start up program section
;
	.glb		start
	.glb		_main
	.glb		_exit
	.glb		$exit
start:							; start address of start up program 
	ldc			#06FFH,ISP		; initialize interrupt stack pointer(ISP)
; -----	initialize processor mode register -----
	bset		prc1			; enable to write 
								; processor mode register 0,1
	mov.b		#00000000B,pm0	; single chip mode 
	mov.b		#00000000B,pm1	; no expand, no wait 
	bclr		prc1			; disable to write  
								; processor mode register 0,1
; -----	initialize system clock control register -----
	bset		prc0			; enable to write
								; system clock control register 0, 1
	mov.b		#00001000B,cm0	; oscillate main clock
	mov.b		#00001000B,cm1	; no main clock division
	mov.b		#00H,ocd		; oscillation stop detection register:select main clock
	bclr		prc0			; disable to write 
								; system clock control register 0, 1
;==============================================================================

	ldc			#0H,FLG			; initialize FLG register
	ldc			#0H,FB			; initialize FB register
	ldc			#data_NE_top,SB	; initialize SB register
								; (for compiler)
	ldintb		#0FEDCH			; initialize INTB register
;
	jsr			RAMCLR			; clear data section with 0 
	jsr			DATINI			; transfer initial value to data section 
;
	fset		I				; interrupt permission(for OAKS8-LCDBoard peripheral library)
;
	jsr			_main			; call main() function
;
_exit:							; end of program
								; (infinite loop status)
$exit:
	jmp			_exit			; call exit() function


;""SUBR	COMMENT""**************************************************************
; ID                : ---
; subroutine name   : RAMCLR
; function          : clear data section with 0 
;                   : (clear section for static varialbe without initial value with 0)
; input             : none
; output            : none
; subroutine used   : none
; stack             : 0 byte
; notice            : use macro N_BZERO
; History           : ---
;""SUBR	COMMENT	END""**********************************************************
RAMCLR:
	N_BZERO	bss_NE_top,bss_NE
	N_BZERO	bss_NO_top,bss_NO
RAMCLR_END:
	rts


;""SUBR	COMMENT""**************************************************************
; ID                : ---
; subroutine name   : DATINI
; function          : transfer initial value to data section 
;                   : (transfer initial value to section for static variable with initial value)
; input             : none
; output            : none
; subroutine used   : none
; stack             : 0 byte
; notice            : use macro N_BCOPY
; History           : ---
;""SUBR	COMMENT	END""**********************************************************
DATINI:	
	N_BCOPY	data_NEI_top,data_NE_top,data_NE
	N_BCOPY	data_NOI_top,data_NO_top,data_NO
DATINI_END:
	rts


;==============================================================================
; dummy interrupt program 
;------------------------------------------------------------------------------
DUMMY_INT:
	reit								;command for returning from interrupt


       .end
;******************************************************************************
;		end of file
;******************************************************************************

⌨️ 快捷键说明

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