哪位大侠告诉我图片怎么粘贴啊?想粘个图片都不会,汗~
我的问题是我用5402的McBSP接收AD的数据,原来用查询可以,就是检测RRDY位。现在换用中断就只能进入一次中断,我很困惑……代码如下:
.title "TLV2541 C5402DSK McBSP0"
.mmregs
.def _c_int00
.def BRINT0_ISR
.width 80
.length 55
.sect ".vectors"
.copy "C5402vec.asm"
.sect ".data"
.include regs.h
**Local and Global variables defined**
AD_DP .usect ".varibl", 0 ;Data page label for variables.
ADWORD .usect ".varibl", 1 ;Temporarily Store Sample in this variable
Temp .usect ".varibl", 1
.sect ".text"
_c_int00:
***Initialize DSP***
DP=#0; ;Memory Mapped Registers in Data Page 0
;Set DSP Clock Frequency
CLKMD =#0 ;Switch to DIV mode
TstStatu:
A=CLKMD ;Test Clock Mode Status
A &= #01b ;mask out PLL status bit
if (ANEQ ) goto TstStatu ;wait until DIV mode is enabled
CLKMD = #4007h ;Set c5402 DSP clock to 100MHz.
SP=#3CFFh ;Set Stack pointer
INTM=#1 ;Disable all interrupts.
SXM=#0 ;No Sign Extension
CPL=0 ;DP used for relative addressing
PMST = #00a0h ;Re-map Interrupt Vector Table to 0x0080h in Program Memory
IMR = #0010h ;enable RINT0 interrupts
IFR = #0FFFFh ;Clear all Pending Interrupts
SWWSR = #2000h ;Need Wait-State of at least 2.
DP=#ADWORD ;Change Data Page to where Variables are stored.
@Temp=#0001h ;Set CPLD
port(DSP_CPLD_CNTL2) [email==@Temp]=@Temp[/email] ;Select daughter board as source for McBSP0
call McBSP0_init ;Intialize McBSP0
INTM=#0 ;Enable global interrupts
DP=#AD_DP ;
AR7=#3200h ;Address to store Samples at.
*Begin conversion cycle*
A=#0000h
mmr(McBSP0_DXR1)=A ;Loading Accum. A with 0x0 to generate FSX/R pulse.
HERE:
repeat(#1000) ;Do nothing. Allow enough time for conversion
NOP
goto HERE
BRINT0_ISR:
PUSH (ST0)
PUSH (ST1)
PUSH (AR2) ;Save Registers
PUSH (AR1)
PUSH (AR0)
DP=#AD_DP
AR2=#McBSP0_DRR1
NOP
B=*AR2 ;Read out Reciever and store in Accumulator B
B=B<<<-4 ;Shift data to right by 4
@ADWORD=B ;Move 12-bit WORD to ADWORD
repeat(#280) ;Do nothing. Allow enough time for conversion
NOP
AR0=#3400h ;Table ends at 0x3400h
DP=#ADWORD ;Load Data Page Pointer with data page of ADWORD
TC = (AR0 == AR7) ;is AR7 = AR0? (table end reached?)
if (TC) goto Reset_Data_Table ;If table end reached move reset pointer to begining
;of table
*AR7+ = data(@ADWORD) ;Store 12-bit Sample at location pointed to by AR7
goto BACK
Reset_Data_Table:
AR7=#3200h ;Point to first position in data table
BACK:
A=#0000h
mmr(McBSP0_DXR1)=A ;Loading Accum. A with 0x0 to generate FSX/R pulse.
AR0 =POP()
AR1 =POP()
AR2 =POP()
ST1 =POP()
ST0 =POP()
RETURN
**Function Configures McBSP0**
McBSP0_init:
mmr(McBSP0_SPSA) = #SPCR1 ;Reset McBSP0 Receiver
A=mmr(McBSP0_SPSD)
A = #0FFFEh & A ;RRST*=0
mmr(McBSP0_SPSD) =A
repeat(#5)
NOP
mmr(McBSP0_SPSA) = #SPCR2 ;Reset McBSP0 Receiver
A=mmr(McBSP0_SPSD)
A= A & #0FF7Fh ;FRST*=0
A= A & #0FFBFh ;GRST*=0
A= A & #0FFFEh ;XRST*=0
A=A|#0200h ;enable free running mode
mmr(McBSP0_SPSD) = A ;
repeat(#5)
NOP
mmr(McBSP0_SPSA) = #PCR ;FSXM & CLKXM output pin driven
mmr(McBSP0_SPSD) = #0A00h ;by Sample Rate Generator
;FSRM & CLKRM input pins
;driven by external source
repeat(#6)
NOP
mmr(McBSP0_SPSA) = #RCR1 ;
mmr(McBSP0_SPSD) = #0040h ;One 16-bit Word per frame
repeat(#6)
NOP
mmr(McBSP0_SPSA) = #RCR2 ;One 16-bit Word per frame
mmr(McBSP0_SPSD) = #0041h ;one bit receive bit data delay
repeat(#6)
NOP
mmr(McBSP0_SPSA) = #XCR1
mmr(McBSP0_SPSD) = #0040h ;One 16-bit Word per frame
repeat(#6)
NOP
mmr(McBSP0_SPSA) = #XCR2 ;One 16-bit Word per frame
mmr(McBSP0_SPSD) = #0041h ;one bit receive bit data delay
repeat(#6)
NOP
mmr(McBSP0_SPSA) = #SRGR1 ;FSX/R is one clock width
A=#0009h
mmr(McBSP0_SPSD) = A ;SRG clock divider=9 (CPU Clock /1+CLKGDV)=10Mhz
repeat(#6)
NOP
mmr(McBSP0_SPSA) = #SRGR2 ;SRG lcok derived from CPU clock
mmr(McBSP0_SPSD) = #2000h ;FSX due to transfer DXR->XSR
;32 sclks
repeat(#6)
NOP
mmr(McBSP0_SPSA) = #SPCR2
A=mmr(McBSP0_SPSD)
A= A | #0040h ;GRST*=1
mmr(McBSP0_SPSD) = A ;Frame Generator and sample
;sample-rate generator enabled
repeat(#6)
NOP
A= A | #0001h ;XRST*=1
mmr(McBSP0_SPSD) = A ;Transmitter enabled
repeat(#6)
NOP
mmr(McBSP0_SPSA) = #SPCR1 ;RRST*=1
A= mmr(McBSP0_SPSD)
A= A | #0001h
mmr(McBSP0_SPSD) = A ;Reciever enabled
repeat(#6)
NOP
RETURN
.end |