资源描述:
《DSP硬件实验报告.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、DSP硬件实验报告班级2008211203学号08210977姓名文通实验一:Esp01.asm:;FileName:exp01.asm;theprogramiscompiledatnoautoinitializationmode.mmregs.global_main_main:stm#3000h,sp;立即数3000h被存入堆栈指针寄存器sp中,ssbxxf;令xf=1,对应的xf亮灯calldelay;执行0.5秒延迟rsbxxf;令xf的值置0,对应的xf亮灯calldelay;执行0.5秒延迟
2、b_main;无条件调用main函数nop;无任何操作nop;delay.5seconddelay:;延迟0.5sstm270fh,ar3;将ar3的地址为270fhloop1:stm0f9h,ar4;将ar4的地址置为0f9h,loop为一个循环loop2:banzloop2,*ar4-;判断ar4的值,若不为零,ar4-1直到其值变为零后再执行下一条banzloop1,*ar3-;判断ar3的值是否为零,若不为零则将ar3的值减一,跳回loop1ret;返回nopnop;stm2cycles;ba
3、nzwhenTRUE4cycles;FALSE2cycles;0f9h=>249d;270fh=>9999d.end实验二:Exp02.asm:*FileName:exp02.asm;getsomeknowledgeofthecmdfile;theprogramiscompiledatnoautoinitializationmode.mmregs.global_main_main:;storedatastm1000h,ar1;将立即数1000h送入辅助寄存器ar1(内存);stm5000h,ar1;将
4、立即数5000h送入辅助寄存器ar1(外存)rpt#07h;循环执行下一条指令8次st0aaaah,*ar1+;将ar1地址加一并赋值0aaaah,执行8次;readdatathenre-storestm7h,ar3;令辅助寄存器ar3的初值为7h;stm5000h,ar1;重新将立即数5000h送入辅助寄存器ar1;stm5008h,ar2;将立即数5008h送入辅助寄存器ar2stm1000h,ar1;重新将立即数1000h送入辅助寄存器ar1stm1008h,ar2;将立即数1008h送入辅助寄
5、存器ar2loop:ld*ar1+,t;将ar1的值存入t寄存器,ar1地址加一stt,*ar2+;t寄存器内容存入ar2,ar2地址加一banzloop,*ar3-;判断ar3的值,若不为零,循环执行loop,将其值减一,若为零则执行下一语句here:bhere;banzwhenTRUE4cycles;FALSE2cycles;loop跳到指定的某一行;sto状态寄存器0st1状态寄存器1.end实验三:Exp03.asm:;FileName:exp03.asm;learnhowtooperatet
6、heI/Oports;getsomeknowledgeoftherts.libfile;intheI/Ospace0x0000=>8switches;0x0001=>8LEDs.mmregs.global_main.text_main:stm3100h,sp;sp地址置为3100hstm1000h,ar1;ar1地址置为1000hportr00h,*ar1;从端口00h读出开关状态,存入ar1中。*ar1=port(00h)nop;空操作nopportw*ar1,01h;将ar1的内容即开关状态写入到
7、led灯上nopnopb_mainnopnop.end实验四:Exp04.c#includeinterruptvoidtimer();/*externvoidtime();*/externvoidinitial();externvoidporta();externvoidportb();intflag=0;定义flag初值为0interruptvoidtimer(){*(int*)0x300=*(int*)0x300+1;if(*(int*)0x300==0x3e8);循环自加100
8、0次{*(int*)0x300=0;*(int*)0x302=*(int*)0x302+1;if(flag==0){flag=1;porta();;若flag值为0,则将其置为1,执行porta}else{flag=0;portb();;若flag值为1,则将其置为0,执行portb}}return;}main(){initial();执行初始化while(1){;}}Port.asm:.mmregs.global_porta.global_portb_