數字訊號處理實驗報告
學院: 電子工程學院
班級: 2012211207
學號: 2012210995
班內序號: 04
姓名: 王孟哲
;file name:exp01.a**
;the program is ***piled at no autoinitialization mode
.mmregs
.global _main
_main:
stm #3000h,sp ;堆疊指標的首位址設為#3000h
ssbx xf狀態暫存器位置位,燈亮
call delay呼叫delay函式延時
rsbx xf狀態暫存器位復位,燈滅
call delay呼叫delay函式延時
bmain可選擇延遲的無條件轉移,迴圈執行
nop無任何操作
nop;delay .5 second
delay演示0.5秒
stm 270fh,ar3 ;把位址存放到儲存器對映暫存器中
loop1
stm 0f9h,ar4 ;把位址存放到儲存器對映暫存器中
loop2:
banz loop2,*ar4- ;ar4不為0時轉移,指標位址減一
banz loop1,*ar3- ; 若不為0,ar3減1,共進行10000*250次跳轉
retreturn,返回
nop ;no operation
nop;stm 2 cycles
;banz when true 4 cycles
false 2 cycles
;0f9h=>249d
;270fh=>9999d
.end
*file name:exp02.a**
;get some knowledge of the cmd file
;the program is ***piled at no autoinitialization mode
.mmregs
.global _main
_main主函式
;store data ;儲存資料
stm 1000h,ar1 ;ar1對映到記憶體1000h位
;stm 5000h,ar1 ;address of exterior memory
rpt #07h迴圈執行下一條指令7次
st 0aaaah,*ar1+ ;data 儲存暫存器的值
;read data then re-store
stm 7h,ar3設定ar3
;stm 5000h,ar1 ;address of exterior memory
;stm 5008h,ar2 ;address of exterior memory
stm 1000h,ar1 ;設定ar1為1000h
stm 1008h,ar2 ;設定ar2為1008h
loop:
ld *ar1+,t把單資料儲存運算元裝入t暫存器中
st t,*ar2儲存t暫存器的值
banz loop,*ar3- ;迴圈7次
here:
b here可選擇延遲的無條件轉移,迴圈執行
.end
;file name :exp03.a**
;learn how to operate the i/o ports
;get some knowledge of the rts.lib file
;in the i/o space 0x0000=>8 switches
0x0001=>8 leds
.mmregs
.global _main
.text
_main主函式
stm 3100h,sp ;堆疊指標的首位址設為#3100h
stm 1000h,ar1 ;define the address,定義ar1的位址
portr 00h,*ar1從埠把資料讀到資料儲存單元中
nopno operation
nopportw *ar1,01h ;ar1裡的資料輸入到01h,控制等的亮滅
nopnopb _main尋迴圈執行
nopnop
.end
定時器實驗時要用到c54晶元的定時器控制暫存器,定時器時間常數暫存器,定時器中斷響應,暫存器定義詳見c54晶元資料。c54的定時器是乙個20位的減法計數器,可以被特定的狀態位實現停止、重新啟動、重設定或禁止,可以使用該定時器產生週期性的cpu中斷,控制定時器中斷頻率的兩個暫存器是定時週期暫存器prd和定時減法暫存器tddr。
定時器實驗通過 led(lp1~lp7)來顯示。在本系統中,時鐘頻率為20mhz,令prd = 0x4e1f,這樣得到每1/1000秒中斷一次,通過累計1000次,就能定時1秒鐘。
【初始化程式】
.mmregs
.global _initial
_initial:
stm 300h,ar1初始化300h 資料位址,設定ar1的位址
st #00h,*ar1 ;輔助暫存器ar1指向#00h
stm 302h,ar1初始化 302h 資料位址,設定ar2的位址
st #00h,*ar1
stm 200h,ar1
st #5555h,*ar1
stm 201h,ar1
st #0aaaah,*ar1
stm 202h,ar1
st #400h,*ar1
ssbx 1,11將置為1,停止所有中斷
stm 0ffffh,ifr ;清除所有中斷標識 ifr:中斷標誌暫存器
stm 00h,imr將立即數暫存器置為0,停止所有中斷
stm 410h,tcr ;停止計時器 tcr:傳送控制暫存器
stm 4e1fh,prd ;將初始時間設為4e1fh
stm 420h,tcr ;開始計時器
stm 08h,imr ;允許計時器中斷
rsbx 1,11將置為0,開始所有中斷
ret【埠程式】(定義管腳)
.mmregs
.global _porta
.global _portb
_porta:
stm 304h,ar1 ;設定ar1位址
st 5555h,*ar1 ;輔助暫存器ar1指向5555h
portw *ar1,01h ;ar1的值做輸出控制小燈亮滅
ret_portb:
stm 304h,ar1 ;設定ar1位址
st 0aaaah,*ar1 ;輔助暫存器ar1指向0aaaah
portw *ar1,01h ;ar1的值控制亮滅
ret【向量程式】
.sect ".vectors"
.ref _c_int00c程式入口
.ref _timer時間中斷點
.align 0x80必須被鏈結到頁邊界
reset重設向量
bd _c_int00到c入口點的分支
stm #200,sp堆疊大小為200 sp:堆疊暫存器
nmi: rete啟動中斷並從乙個返回
nopnop
nop軟體中斷
sint17 .space 4*16
sint18 .space 4*16
sint19 .space 4*16
sint20 .space 4*16
sint21 .space 4*16
sint22 .space 4*16
sint23 .space 4*16
sint24 .space 4*16
sint25 .space 4*16
sint26 .space 4*16
sint27 .space 4*16
sint28 .space 4*16
sint29 .space 4*16
sint30 .space 4*16
int0: rete
nopnop
nopint1: rete
nopnopnop
int2: rete
nopnop
noptint: b _timer設定實用time中斷
nopnop
rint0: rete
nopnop
nopxint0: rete
nopnop
noprint1: rete
nopnop
nopxint1: retenop
DSP硬體實驗報告
北京郵電大學 實驗一 常用指令實驗 一 實驗目的 1.熟悉dsp開發系統的連線 2.了解dsp開發系統的組成和結構和應用系統構成 3.熟悉常用c54x系列指令的用法 程式定址,暫存器,i o口,定時器,中斷控制 二 實驗裝置 計算機,ccs 2.0版軟體,dsp 器,實驗箱。三 實驗操作方法 1 系...
DSP硬體實驗報告
班級學號姓名 班內序號 2014年12月23日 第一部分 5416常規實驗 實驗一 常用指令實驗 截圖及注釋 1 實驗目的 了解dsp開發系統的組成和結構,熟悉dsp開發系統的連線,熟悉dsp的開發介面,熟悉c54x系列的定址系統,熟悉常用的c54x系列指令的用法。2 截圖 3 源 注釋 mmreg...
DSP硬體實驗報告
實驗一 簡單指令程式執行實驗 含注釋 mmregs global main main stm 3000h,sp sp為堆疊指標暫存器,stm為儲存器對映暫存器定址 ssbx xfxf賦值為1,燈亮 call delay呼叫delay函式,延遲0.5秒 rsbx xfxf賦值為0,燈滅 call de...