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

📄 ccs_basic.s54

📁 TMS320C54X系列在CCS3.1 下的实验教程
💻 S54
字号:
;******************************************************************************
;               		SJTU DSP Tech. Center
;        Copyright (c) 2003 SJTU DSP Tech. Center. All Rights Reserved.
;
;  Description:
;  		TMS320C54x Program for Students Experiment
;
;  History:
;		Date		Authors			Changes
;		2003/07/15	Xu Sheng		Created.
;******************************************************************************

;Target:
;	Be familar with the use of CCS (Code Composer Studio)

;******************************************************************************
;An example to show how to write an assembly language source file
;	y=a1*x1+a2*x2 
;******************************************************************************
    
;----------- Const definition
STACK_ADDR		.set		0x0500		;bottom of stack
	;allocate data in .bss section
	.bss a,2							;allocate 5 word for variates
	.bss x,2
	.bss y,1
		
	;allocate data in .data section
	.data
table: 									;data follows ...
	.word 1,3
	.word 8,6

	
	.mmregs								;enable memory mapped registers
	.global	main                        ;define global symbols
;------------------------------------------------------------------------------
	.text
main:
	stm		#STACK_ADDR, SP		;set stack
	stm		#0x00a8, PMST		;relocate Interrupt Vector Table
	stm		#0x0000, SWWSR		;no software wait for all memory
	;================================================
	
	stm		#a, AR2				;AR1 point to a 
	stm		#table, AR3			;AR2 point to table
	rpt     #1					;repeat next instrument 1 time
	mvdd    *AR3+, *AR2+		;from data memory into data memory
	
	stm		#x, AR2				;AR1 point to a 
	rpt     #1					;repeat next instrument 1 time
	mvdd    *AR3+, *AR2+		;from data memory into data memory
	
	call    SUM		;call function to do sum

	;dead loop part to lock PC in a know area when program ends
dead_loop:
	nop
	nop
	nop
	b		dead_loop

;================================================
;	y=a1*x1+a2*x2 
SUM:
	stm   	#a, AR3
	stm 	#x, AR4
	rptz 	A, #1
	mac 	*AR3+, *AR4+, A
	stl     A, *(y)
	ret
	
;------------------------------------------------------------------------------
;Interrupt Vector Table, for simplicity Only RESET interrupt is defined
	.sect	"vectors"
int_RESET:
	b		main		;when reset, jump to main
	nop
	nop

	.space	124*16		;no other interrupt used, keep them space

;end of lab1.s54		

⌨️ 快捷键说明

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