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

📄 ex9p5pgm.asm

📁 用于DSK5416的程序
💻 ASM
字号:
*******************************************************************************
*                                                                     
*  PROGRAM FOR EXAMPLE 9.5 (File: ex9p5.asm) 
*
*  DESCRIPTION: This C54xx program reads an input signal applied to the ADC
*               and outputs it to the DAC. The ADC is read and the data is
*               written to the DAC in the interrupt service rotine for INT1.
*
*  AUTHOR:      Avtar Singh, SJSU
*                   		    
******************************************************************************
		
                .ref _c_int00
                .mmregs                         ; memory mapped reg definitions
		
buffer:         .bss sample, 1                  ; data buffer

                .text
_c_int00:      
                stm #0x0500, SP                 ; init SP to 0x0500
                ssbx INTM                       ; disable all interrupts
                call init_DSP                   ; init DSP processor
                call init_timer                 ; init timer
                stm #0xFFFF, IFR                ; clear any pending interrupt
                orm #0002h, IMR                 ; unmask INT1 interrupt
                rsbx INTM                       ; enable all interrupts
 
wait_main:      ;You may insert code here to be executed during interrupt wait
                b wait_main                     ; wait for an INT1 interrupt

						
;-----------------------------------------------------------------
; Processor Intialization Routine
;-----------------------------------------------------------------

PMST_VAL        .set 00A0h                      ; Interrupt vect at 80h,
                                                ; MP/(MC*) = 0, OVLY = 1
BSCR_VAL        .set 0000h                      ; 64K mem bank, no extra cycles
                                                ; between consecutive reads
SWWSR_VAL       .set 2000h                      ; I/O wait states = 2 clocks

                .text
init_DSP:
                ld #0, DP                       ; Data page = 0
                stm #0, CLKMD
                stm #0, CLKMD
                stm #0x4007, CLKMD              ; Processor speed = 5 x PLL
                stm #PMST_VAL, PMST             ; Init Processor Mode Status Reg
                stm #BSCR_VAL, BSCR             ; Set Bank Switching Wait States
                stm #SWWSR_VAL, SWWSR           ; Set S/W Wait State Reg 
                ssbx OVM                        ; Saturate on overflow
                ssbx SXM                        ; Select sign extension mode
                ret                             ; Return
                nop
                nop

;-----------------------------------------------------------------
; Timer Intialization Routine
; Timer out (TOUT) frequency = CPU Clock/(PRD+1) = sampling freq
;-----------------------------------------------------------------

PRD_value       .set 9999                       ; PRD value for 8 KHz TOUT
TCR_value       .set 0000                       ; TCR value to start timer

                .text
init_timer:
                stm PRD_value, PRD              ; init PRD register
                stm TCR_value, TCR              ; start the timer
                ret                             ; return
                nop
                nop
	
;-----------------------------------------------------------------
; Interrupt Service Routine
; This reads the 10-bit ADC sample, converts it to an 8-bit sample
; and writes it to the 8-bit DAC.
;-----------------------------------------------------------------

ADC_Data_In     .set 05h                        ; ADC data-in I/O address
DAC_Data_Out    .set 07h                        ; DAC data-out I/O address

                .text
INT1_ISR:
                portr ADC_Data_In, sample       ; read the ADC data
                ld sample, -2, A                ; convert 10-bit data to-8 bit
                stl A, sample                   ; save as 8-bit data

                                                ; Place for any DSP algorithm

                portw sample, DAC_Data_Out      ; write data to DAC
                rete                            ; return
                nop
                nop

;------------------------------------------------------------------
;  Interrupt Vector Table
;------------------------------------------------------------------
	      	
                .sect   ".vectors"
RESET:          B _c_int00                      ; Reset vector
                NOP
                NOP
NMI:            RETE                            ; Non Maskable Interrupt vector
                NOP
                NOP
                NOP						
                .space 4*15*16                  ; Space for unused vectors
INT1:           B INT1_ISR                      ; INT1 Vector
                NOP
                NOP
                .space 4*12*16                  ; Space for unused vectors

                .end		





⌨️ 快捷键说明

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