您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 商业计划书 > 基于CCS的软件仿真正弦三角余弦任意波形汇编语言
.titlefountionout.asm.mmregs.def_c_int00.globalsinx,d_xs,d_sinx,cosx,d_xc,d_cosx,sinx_out,rect_out,tria_outsin_x:.usectsin_x,360STACK:.usectSTACK,10interval.set1.bsscount,1.bssoutput,1800_c_int00:ST#0,*(count)STM#STACK+10,SPSTM#2,AR7CMPMAR7,#3;#3产生方波BCrect_sub,TCCMPMAR7,#2;#2产生三角波BCtria_sub,TCCMPMAR7,#1;#1产生正弦信号BCsin_sub,TC;CMPMAR7,#4;BCrand_sub,TC;#4产生随机信号;nopnopend:bendsin_sub:nopnopCALLsinx_outBconrect_sub:nopnopCALLrect_outnopnopBcontria_sub:nopnopCALLtria_outnopnopBcon;rand_sub:nop;nop;callrand;nopnopcon:STM#sin_x,AR5STMinterval,AR0STM#360,BKSTM#output,AR2loop4:MVDD*AR5+0%,*AR2+ADDM#1,*(count)CMPM*(count),1800NOPNOPBCdone,tcbloop4done:bdone*产生sin函数sinx_out:k_stheta.set286;theta=pi/360(0.5deg.).textSTMk_stheta,AR0;AR0--k_sthetaSTM0,AR1;AR1=xSTM#sin_x,AR6STM#90,BRC;fromsin0---sin90(deg)RPTBloop1-1LDMAR1,ALD#d_xs,DPSTLA,@d_xsSTLA,@d_xcCALLsinx;(d_sinx)=sin(x)CALLcosx;(d_cosx)=cos(x)LD#d_sinx,DPLD@d_sinx,16,A;A=sin(x)MPYA@d_cosx;B=sin(x)*cos(x)STHB,1,*AR6+;AR6--2*sin(x)*cos(x)MAR*AR1+0;每次增加0.5loop1:STM#sin_x+89,AR7;sin(91)---sin(179)STM#88,BRCRPTBloop2-1LD*AR7-,ASTLA,*AR6+loop2:STM#179,BRC;sin(180)---sin(359)STM#sin_x,AR7RPTBloop3-1LD*AR7+,ANEGASTLA,*AR6+loop3:RET*sin(theta)=x(1-x^2/2*3(1-x^2/4*5(1-x^2/6*7(1-x^2/8*9))))sinx:.defd_xs,d_sinx.datatable_s.word01c7h;1/(8*9).word030bh;1/(6*7).word0666h;1/(4*5).word1556h;1/(2*3)d_coef_s.usectcoef_s,4d_xs.usectsin_vars,1d_squr_xs.usectsin_vars,1d_temp_s.usectsin_vars,1d_sinx.usectsin_vars,1c_1_s.usectsin_vars,1.textSSBXFRCTSTM#d_coef_s,AR5RPT#3MVPD#table_s,*AR5+STM#d_coef_s,AR3STM#d_xs,AR2STM#c_1_s,AR4ST#7FFFh,c_1_s;7fffh==1SQUR*AR2+,ASTA,*AR2||LD*AR4,BMASR*AR2+,*AR3+,B,AMPYAASTHA,*AR2;AR2--d_temp_sMASR*AR2-,*AR3+,B,AMPYA*AR2+STB,*AR2||LD*AR4,BMASR*AR2-,*AR3+,B,AMPYA*AR2+STB,*AR2||LD*AR4,BMASR*AR2-,*AR3+,B,AMPYAd_xsSTHB,d_sinxRET*cos(theta)=1-x^2/2(1-x^2/3*4(1-x^2/5*6(1-x^2/7*8)))cosx:.defd_xc,d_cosxd_coef_c.usectcoef_c,4.datatable_c.word0249h;1/(7*8).word0444h;1/(5*6).word0aabh;1/(3*4).word4000h;1/2d_xc.usectcos_vars,1d_squr_xc.usectcos_vars,1d_temp_c.usectcos_vars,1d_cosx.usectcos_vars,1c_1_c.usectcos_vars,1.textSSBXFRCTSTM#d_coef_c,AR5RPT#3MVPD#table_c,*AR5+STM#d_coef_c,AR3STM#d_xc,AR2STM#c_1_c,AR4ST#7FFFh,c_1_cSQUR*AR2+,ASTA,*AR2||LD*AR4,BMASR*AR2+,*AR3+,B,AMPYAASTHA,*AR2MASR*AR2-,*AR3+,B,AMPYA*AR2+STB,*AR2||LD*AR4,BMASR*AR2-,*AR3+,B,ASFTAA,-1,ANEGAMPYA*AR2+MAR*AR2+RETDADD*AR4,16,BSTHB,*AR2RETrect_out:k_rtheta.set7FFFh;theta=pi/180(1deg.).textLD#7FFFh,A;LD#4000h,ASTM#sin_x,AR6STM#180,BRCRPTBloopr1-1STLA,*AR6+loopr1:STM#180,BRCRPTBloopr3-1LD#0h,A;LD#0C000h,ASTLA,*AR6+loopr3:RETtria_out:k_ttheta.set364;theta=1/90(0.5deg.).textssbxfrctST#0,*(count)*LD#-1,ALD#0,ASTM#STACK+10,SPSTMk_ttheta,AR0STM0,AR1STM#sin_x,AR6STLA,*AR6+STM#89,BRCRPTBloopt1-1ADDAR0,ASTLA,*AR6+loopt1:STM#sin_x+89,AR7STM#89,BRCRPTBloopt2-1LD*AR7-,ASTLA,*AR6+loopt2:STM#178,BRCSTM#sin_x+1,AR7RPTBloopt3-1LD*AR7+,ANEGASTLA,*AR6+loopt3:STM#sin_x,AR5STMinterval,AR0STM#360,BKSTM#output,AR2loopt4:MVDD*AR5+0%,*AR2+ADDM#1,*(count)CMPM*(count),1800BCdonet,tcbloopt4donet:bdonetRET;rand:;.bssk,1;.text;NOP;NOP;在这里加探针,导入数据,数据文件为wgn.dat;;NOP;NOP;ret.end
本文标题:基于CCS的软件仿真正弦三角余弦任意波形汇编语言
链接地址:https://www.777doc.com/doc-4683350 .html