📄 mcbsp_mode.asm
字号:
.include "mcbsp_reg.asm"
.def spiFive8BitMode
.def spiDouble8BitMode
.def setToReadSequenceMode;single phase, 16bit-mode, 128channal.
.def spiDouble8BitModeSecond
.text
setToReadSequenceMode:;single phase, 16bit-mode, 128channal.
*port(RCR1_0)=#7f40h
*port(RCR2_0)=#1h
*port(XCR1_0)=#7f40h
*port(XCR2_0)=#1h
*port(SRGR2_0)=#3800h
*port(MCR1_0)=#1h
*port(MCR2_0)=#1h
*port(RCERA_0)=#0fffch
*port(XCERA_0)=#03h
*port(RCERB_0)=#0ffffh
*port(RCERC_0)=#0ffffh
*port(RCERD_0)=#0ffffh
*port(RCERE_0)=#0ffffh
*port(RCERF_0)=#0ffffh
*port(RCERG_0)=#0ffffh
*port(RCERH_0)=#0ffffh
*port(XCERB_0)=#0
*port(XCERC_0)=#0
*port(XCERD_0)=#0
*port(XCERE_0)=#0
*port(XCERF_0)=#0
*port(XCERG_0)=#0
*port(XCERH_0)=#0
return
spiDouble8BitMode:
;disable the globle interrupt ;
bit(st1,#11)=#0h
;reset the mcbsp usin serial port control register2
*port(SPCR2_0)=#0200h ; doesn't need here
;set the mcbsp value
*port(SPCR1_0)=#1010h
;here is the receive word length and word size
*port(RCR1_0)=#0100h
*port(RCR2_0)=#0001h ;receive frame don't ignal, and delay=1 bit
;*port(RCR1_0)=#0400h ; for orignal use
*port(XCR2_0)=#0001h;;change here
;*port(XCR1_0)=#0400h ;change here for the frame length and word length
*port(XCR1_0)=#0100h
;set the mcbsp clk freqency in sample rate generater 2
;*port(SRGR2_0)=#3028h
*port(SRGR2_0)=#3010h
*port(SRGR1_0)=#0009h ;change the frequency here to /9+1
repeat(#10)
nop_16
;pin control register
*port(PCR0)=#0a03h ;active high, 3 is thoery value.
*port(MCR1_0)=#0001h ;never be changed!
*port(MCR2_0)=#00001h ;change for the mutichannal
*port(RCERA_0)=#0002h
*port(XCERA_0)=#0003h
*port(RCERB_0)=#0
*port(RCERC_0)=#0
*port(RCERD_0)=#0
*port(RCERE_0)=#0
*port(RCERF_0)=#0
*port(RCERG_0)=#0
*port(RCERH_0)=#0
*port(XCERB_0)=#0
*port(XCERC_0)=#0
*port(XCERD_0)=#0
*port(XCERE_0)=#0
*port(XCERF_0)=#0
*port(XCERG_0)=#0
*port(XCERH_0)=#0
;de-reset the serial port control register2 by 3 steps
;1: sample rate generate
;2: dx and dr
;3: frame syc.
*port(SPCR2_0)=#0040h
repeat(#20)
nop_16
*port(SPCR2_0)=#0041h
*port(SPCR1_0)=#0081h
*port(SPCR2_0)=#02C1h
repeat(#80)
nop_16
return
spiFive8BitMode:
;reset the mcbsp usin serial port control register2
*port(SPCR2_0)=#0200h;#0210h ;0200
;set the mcbsp value
*port(SPCR1_0)=#80h;#2010h;80
*port(RCR2_0)=#0001h ;receive frame don't ignal, and delay=1 bit
*port(RCR1_0)=#0400h
*port(XCR2_0)=#0001h;;change here
*port(XCR1_0)=#0400h ;change here for the frame length and word length
;set the mcbsp clk freqency in sample rate generater 2
*port(SRGR2_0)=#3028h;#3028h;
*port(SRGR1_0)=#0009h ;change the frequency here to /9+1
repeat(#10)
nop_16
;pin control register
*port(PCR0)=#0a03h ;active high, 3 is thoery value.
*port(MCR1_0)=#0001h ;never be changed!
*port(MCR2_0)=#0001h ;change for the mutichannal
*port(RCERA_0)=#00h;#0010h
*port(XCERA_0)=#0h;00fh
*port(RCERB_0)=#0
*port(RCERC_0)=#0
*port(RCERD_0)=#0
*port(RCERE_0)=#0
*port(RCERF_0)=#0
*port(RCERG_0)=#0
*port(RCERH_0)=#0
*port(XCERB_0)=#0
*port(XCERC_0)=#0
*port(XCERD_0)=#0
*port(XCERE_0)=#0
*port(XCERF_0)=#0
*port(XCERG_0)=#0
*port(XCERH_0)=#0
;de-reset the serial port control register2 by 3 steps
;1: sample rate generate
;2: dx and dr
;3: frame syc.
*port(SPCR2_0)=#0040h;#0250h
repeat(#20)
nop_16
*port(SPCR2_0)=#0041h
*port(SPCR1_0)=#0081h;old value is 0080 disable or 0081 enable
*port(SPCR2_0)=#02c1h
repeat(#80)
nop_16
return
return
spiDouble8BitModeSecond:
;disable the globle interrupt ;
bit(st1,#11)=#0h
;reset the mcbsp usin serial port control register2
;*port(SPCR2_0)=#0200h ; doesn't need here
;set the mcbsp value
;*port(SPCR1_0)=#1010h
*port(RCR2_0)=#0001h ;receive frame don't ignal, and delay=1 bit
;*port(RCR1_0)=#0400h ; for orignal use
*port(RCR1_0)=#0100h
*port(XCR2_0)=#0001h;;change here
;*port(XCR1_0)=#0400h ;change here for the frame length and word length
*port(XCR1_0)=#0100h
;set the mcbsp clk freqency in sample rate generater 2
;*port(SRGR2_0)=#3028h
*port(SRGR2_0)=#3010h
*port(SRGR1_0)=#0009h ;change the frequency here to /9+1
repeat(#10)
nop_16
;pin control register
*port(PCR0)=#0a03h ;active high, 3 is thoery value.
*port(MCR1_0)=#0001h ;never be changed!
*port(MCR2_0)=#00001h ;change for the mutichannal
*port(RCERA_0)=#0000h
*port(XCERA_0)=#0003h
*port(RCERB_0)=#0
*port(RCERC_0)=#0
*port(RCERD_0)=#0
*port(RCERE_0)=#0
*port(RCERF_0)=#0
*port(RCERG_0)=#0
*port(RCERH_0)=#0
*port(XCERB_0)=#0
*port(XCERC_0)=#0
*port(XCERD_0)=#0
*port(XCERE_0)=#0
*port(XCERF_0)=#0
*port(XCERG_0)=#0
*port(XCERH_0)=#0
;de-reset the serial port control register2 by 3 steps
;1: sample rate generate
;2: dx and dr
;3: frame syc.
;*port(SPCR2_0)=#0040h
;repeat(#20)
;nop_16
;*port(SPCR2_0)=#0041h
;*port(SPCR1_0)=#0081h
;*port(SPCR2_0)=#02C1h
;repeat(#80)
;nop_16
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -