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

📄 f206adda.asm

📁 this a DSP program for sine wave design
💻 ASM
字号:
		.title		"TMS320F206EVM Sampling Routin[AD876]"
        .global		_c_int0  
************************************************
**  Input signal:0-2Vp-p
************************************************
        
*===============================================================================
*  TMS320F206EVM resources list
*------------------------------------
*
*    program: 
*			  On chip flash:(0000-7fffh), Hard Jump Close
*			  EXT-SRAM:(0000h-7fffh), Hard Jump Open
*             On chip DARAM: B0(FF00-FFFFh, by CNF=1)
*			  On chip SARAM:(8000h-8fffh)(share with data, by PON-->1)
*
*    data(local):
*			  On chip DARAM: B0(200-2FFh, by CNF), B1(300-3FFh), B2(60-7Fh)
*			  Onchip SARAM(800-17ffh) (share with program, by DON-->1)
*			  EXT-SRAM:(800-17ffh, by DON-->0), (1800-7fffh)
*			  EXT-SRAM-read(8000h-0BFFFh): A/D
*			  EXT-SRAM-Write(8000h-0BFFFh): D/A     
*
*    Data(Global): 
*			  EXT-BUS: 8000h-0ffffh
*    I/O: 
*			  On chip resources
*			  EXT-BUS: 8000h-0ffffh   
*
*=============================================================================
*
DLOGLWS	.macro  waitST
*
* 	waitST=0 -->0 wait state, waitST=449h -->IO:2/D:1/PU:1/PD:1 wait state
*
	lacl	#080h	;00h local: 0-FFFFh, 64KWs; 080h local: 0-7FFFh, 32KWs, global:8000h-0ffffh,32KWs
	ldp		#0h	; set DP=0
	sacl	GREG	; local: 0-7FFFh, 32KWs
					; global: 8000h-FFFFh, 32KWs
	splk	#waitST,60h	;
	out		60h,WSGR	; set wait states
	.endm
*
*===============================================================================
*    program: EXT-SRAM(0000-7fffh, no wait state); SARAM(8000h-8fffh)(share with data)
*    data: local =B0(200-2FFh), B1(300-3FFh), B2(60-7Fh)
*		   EXT SRAM: 1800h-7fffh, no wait state
*		   SARAM(800-17ffh) (share with program)
*		   EXT-SRAM-Write(8000h-0BFFFh): D/A     
*=============================================================================
*===========================================
*
; init sampling
;===============
IO0WORK	.set	1h		; output IO0 is high, D-FF Working
IO0CLR	.set	0h		; output IO0 is low, ready to start
*
	.include	"DSP_INIT.H"	; Variable and register declaration
	.include	"DSP_VECT.H"	; Vector label declaration
	.text
*     
_c_int0:
start:			; program begin here
*				; first initialize DSP's working status
	setc	INTM		; Disable all interrupt
	clrc	CNF		; B0 is used as data ram 200h
	ldp		#0
	lacl	#111b
	sacl	60h
	out		60h,PMST 	; set sram to data & program,
						; and set microProcessor mode(use EXT SRAM)
*
	spm	0		; PM=00,no shift of PREG output
	clrc	SXM		; suppresses sign-extension
;*	setc	OVM		; overflow: most positive or negative
	clrc	OVM		; overflow: normal
	clrc	XF		; set XF=0 
*
	ldp		#0
	splk	#0ffffh, IFR	; clear interrupts
*	splk	#0002h, IMR		; enable INT2/3 interrupt, mask the others
	splk	#0000h, IMR		; mask all interrupts
	splk	#11h, 60h		; infact, INT3 is not used and INT2 is used for
	out		60h, ICR     	; the internal trigger and  the external trigger
							; INT2 is default
*
	call	timset		; setting timer initialization (2MHz/0.5us)
						; sampling ratio(1MSPS)

	splk	#0e001h, 60h	; configure bit IO3..1 as input and IO0 as Output
	out		60h, ASPCR		; setting 1 stop bit,Enable the serial port
	splk	#0000h,	60h       			
	out		60h, IOSR
	splk	#0001h,	60h       			
	out		60h, IOSR
*
	DLOGLWS 449h			; setting sampling Greg and WSreg
     
	mar		*, ar0
	lar		ar0, #1
wait1ms:
	rpt		#0fh
	nop      
	banz	wait1ms, *+ 
	     
*============================================         
;  sampling begin
*
    mar		*, ar0
	lar		ar0, #200h
	lar		ar1, #05fffh;2000h
	sar		ar1, *, ar1
goonsam1
	lar		ar1, #2000h
	lar		ar2, #4000h	
    ldp		#(8000h>>7)

goonsam:                  ; sigma=20T-->1.0MHz(1.0uS)
	lacc	00;, 6   ; 8000h=A/D, 2T+1T+1T=4T   
	nop		;1T+1T=2T
;	nop		;1T+1T=2T
;	nop		;1T+1T=2T
;	nop		;1T+1T=2T
	sacl	*+, ar2	; *=ar1/save d(n) to SRAM, (2T+<Read follow Write, Extra 1T>)2T+1T+1T=4T
	banz	goonsam, *-, ar1 ; *=ar2/counter, 4T+4T=8T

;	rpt		*
;	bldd	00h, #2000h	;, ar2      (6 n +4) T
;	b	goonsam	; *=ar3/counter, 4T
*========================================		
 
    b	$

*=====================================
*
*	.title	"sampling clock generation"
*	
********************************************************************************

********************************************************************************
*  clkout1 = 50 nS, TDDR <--- 0, PRD <--- 9, then f=20Mhz/[(0+1)*(9+1)]=2.0Mhz
*  T = 1/2.0Mhz = 0.5uS, so the A/D CLK is 2.0/2=1.0MHz, Tclk=1.0uS
*****************************************************************************
* 		TCR: IS&FFF9h
*	      +-----------+------+------+-----+-----+-----+------+
*	      |	15 ... 12 |  11  |  10  | 9 6 |  5  |  4  | 3  0 |
*	      +-----------+------+------+-----+-----+-----+------+
*	      |	 Reserve  | FREE | SOFT | PSC | TRB | TSS | TDDR |
*	      +-----------+------+------+-----+-----+-----+------+
*==================================================================
timset:            		; initialize the timer
	lar		ar1,#300h      	; T = 0.5 uS
	mar		*,ar1
	splk	#9,*
	out		*,PRD		; set PRD = 9
	splk	#0,*
	out		*,TIM		; set TIM=00000
	splk	#0c20h,*	; PSC,TDDR are zero, reload, restart
	out		*,TCR
	ret
*-------------------------------
*
inpt23: 			; trigger coming, generating INT2,
				; start sampling and filting
	lar	ar7,#00h
	clrc	INTM
	ret
*==================================
inpt1:	ret 			;Unused interrupt
codtx:	ret
codrx:	ret
uart:	ret
timer:	ret
y5nmi:  ret
*=====================================
		.end	
		
				                
                                      
                                      

⌨️ 快捷键说明

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