SkinH_Attach 未定义

来源:互联网 发布:淘宝买家要求花呗 编辑:程序博客网 时间:2024/06/15 11:47
PrivateSubCommand1_Click()  
Dimtimer_clkAsDouble  
DimTsAsDouble  
Dimf_outAsDouble  
DimModulationDepthAsDouble  
ConstPI=3.141592654  
ConstPARA=0.866025403  
DimTBCCR0AsInteger  
DimDimensionAsInteger  
DimSVcounterAsInteger  
DimSV_T1AsDouble  
DimSV_T2AsDouble  
DimSV_T0AsDouble  
TBCCR0=0  
Dimension=0  
SVcounter=0  
SV_T1=0  
SV_T2=0  
SV_T0=0  
timer_clk=Val(Text1.Text)  
Ts=Val(Text2.Text)  
f_out=Val(Text3.Text)  
ModulationDepth=Val(Text4.Text)  
Text5.Text=""  
'计算TBCCR0  
TBCCR0=0.5*1000*timer_clk/Ts  
'计算数组长度  
Dimension=1000*Ts/f_out  
'显示参数资信  
Text5.FontBold=False  
Text5.FontSize=10  
Text5.Text="Theresultsare:"&vbCrLf  
Text5.Text=Text5.Text+"TBCCR0="&Str(TBCCR0)&vbCrLf  
Text5.Text=Text5.Text+"thelengthofarray="&Str(Dimension)&vbCrLf&vbCrLf  
Text5.Text=Text5.Text+"Withfollowingconditions:"&vbCrLf  
Text5.Text=Text5.Text+"Timerclock="&Str(timer_clk)&"MHz;"&vbCrLf  
Text5.Text=Text5.Text+"thefrequencyofeachpulsecircle="&Str(Ts)&"kHz"&vbCrLf  
Text5.Text=Text5.Text+"thefrequencyofoutput="&Str(f_out)&"Hz"&vbCrLf  
Text5.Text=Text5.Text+"themodulationdepth="&Format(Str(ModulationDepth),"0.000")&vbCrLf&vbCrLf  
Text5.Text=Text5.Text+"Thearraysare:"&vbCrLf  
DimSV_cmp1()AsDouble  
DimSV_cmp2()AsDouble  
DimSV_cmp3()AsDouble  
DimSV_PHA()AsInteger  
DimSV_PHB()AsInteger  
DimSV_PHC()AsInteger  
ReDimSV_cmp1(Dimension)  
ReDimSV_cmp2(Dimension)  
ReDimSV_cmp3(Dimension)  
ReDimSV_PHA(Dimension)  
ReDimSV_PHB(Dimension)  
ReDimSV_PHC(Dimension)  
ForSVcounter=0ToDimension-1Step1  
'第一扇区  
IfSVcounter<=(Dimension*1/6-1)AndSVcounter>=0Then  
SV_T1=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*1/6)  
SV_T2=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*9/6)  
SV_T0=(1-SV_T1-SV_T2)/2  
SV_cmp1(SVcounter)=SV_T1+SV_T2+SV_T0  
SV_cmp2(SVcounter)=SV_T2+SV_T0  
SV_cmp3(SVcounter)=SV_T0  
SV_PHA(SVcounter)=Int((1-SV_cmp1(SVcounter))*TBCCR0+0.5)  
SV_PHB(SVcounter)=Int((1-SV_cmp2(SVcounter))*TBCCR0+0.5)  
SV_PHC(SVcounter)=Int((1-SV_cmp3(SVcounter))*TBCCR0+0.5)  
EndIf  
'第二扇区  
IfSVcounter<=(Dimension*2/6-1)AndSVcounter>=(Dimension*1/6)Then  
SV_T1=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*11/6)  
SV_T2=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*7/6)  
SV_T0=(1-SV_T1-SV_T2)/2  
SV_cmp1(SVcounter)=SV_T1+SV_T0  
SV_cmp2(SVcounter)=SV_T1+SV_T2+SV_T0  
SV_cmp3(SVcounter)=SV_T0  
SV_PHA(SVcounter)=Int((1-SV_cmp1(SVcounter))*TBCCR0+0.5)  
SV_PHB(SVcounter)=Int((1-SV_cmp2(SVcounter))*TBCCR0+0.5)  
SV_PHC(SVcounter)=Int((1-SV_cmp3(SVcounter))*TBCCR0+0.5)  
EndIf  
'第三扇区  
IfSVcounter<=(Dimension*3/6-1)AndSVcounter>=(Dimension*2/6)Then  
SV_T1=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*9/6)  
SV_T2=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*5/6)  
SV_T0=(1-SV_T1-SV_T2)/2  
SV_cmp1(SVcounter)=SV_T0  
SV_cmp2(SVcounter)=SV_T1+SV_T2+SV_T0  
SV_cmp3(SVcounter)=SV_T2+SV_T0  
SV_PHA(SVcounter)=Int((1-SV_cmp1(SVcounter))*TBCCR0+0.5)  
SV_PHB(SVcounter)=Int((1-SV_cmp2(SVcounter))*TBCCR0+0.5)  
SV_PHC(SVcounter)=Int((1-SV_cmp3(SVcounter))*TBCCR0+0.5)  
EndIf  
'第四扇区  
IfSVcounter<=(Dimension*4/6-1)AndSVcounter>=(Dimension*3/6)Then  
SV_T1=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*7/6)  
SV_T2=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*3/6)  
SV_T0=(1-SV_T1-SV_T2)/2  
SV_cmp1(SVcounter)=SV_T0  
SV_cmp2(SVcounter)=SV_T1+SV_T0  
SV_cmp3(SVcounter)=SV_T1+SV_T2+SV_T0  
SV_PHA(SVcounter)=Int((1-SV_cmp1(SVcounter))*TBCCR0+0.5)  
SV_PHB(SVcounter)=Int((1-SV_cmp2(SVcounter))*TBCCR0+0.5)  
SV_PHC(SVcounter)=Int((1-SV_cmp3(SVcounter))*TBCCR0+0.5)  
EndIf  
'第五扇区  
IfSVcounter<=(Dimension*5/6-1)AndSVcounter>=(Dimension*4/6)Then  
SV_T1=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*5/6)  
SV_T2=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*1/6)  
SV_T0=(1-SV_T1-SV_T2)/2  
SV_cmp1(SVcounter)=SV_T2+SV_T0  
SV_cmp2(SVcounter)=SV_T0  
SV_cmp3(SVcounter)=SV_T1+SV_T2+SV_T0  
SV_PHA(SVcounter)=Int((1-SV_cmp1(SVcounter))*TBCCR0+0.5)  
SV_PHB(SVcounter)=Int((1-SV_cmp2(SVcounter))*TBCCR0+0.5)  
SV_PHC(SVcounter)=Int((1-SV_cmp3(SVcounter))*TBCCR0+0.5)  
EndIf  
'第六扇区  
IfSVcounter<=(Dimension*6/6-1)AndSVcounter>=(Dimension*5/6)Then  
SV_T1=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*3/6)  
SV_T2=PARA*ModulationDepth*Cos(2*PI*(SVcounter/Dimension)+PI*11/6)  
SV_T0=(1-SV_T1-SV_T2)/2  
SV_cmp1(SVcounter)=SV_T1+SV_T2+SV_T0  
SV_cmp2(SVcounter)=SV_T0  
SV_cmp3(SVcounter)=SV_T1+SV_T0  
SV_PHA(SVcounter)=Int((1-SV_cmp1(SVcounter))*TBCCR0+0.5)  
SV_PHB(SVcounter)=Int((1-SV_cmp2(SVcounter))*TBCCR0+0.5)  
SV_PHC(SVcounter)=Int((1-SV_cmp3(SVcounter))*TBCCR0+0.5)  
EndIf  
NextSVcounter  
Text5.Text=Text5.Text&"unsignedintTB_CCR_A["&Str(Dimension)&"]={"&vbCrLf  
ForSVcounter=0ToDimension-1Step1  
Text5.Text=Text5.Text&Str(SV_PHA(SVcounter))&","  
IfSVcounterMod10=9Then  
Text5.Text=Text5.Text&vbCrLf  
EndIf  
NextSVcounter  
Text5.Text=Text5.Text&"};"&vbCrLf  
Text5.Text=Text5.Text&"unsignedintTB_CCR_B["&Str(Dimension)&"]={"&vbCrLf  
ForSVcounter=0ToDimension-1Step1  
Text5.Text=Text5.Text&Str(SV_PHB(SVcounter))&","  
IfSVcounterMod10=9Then  
Text5.Text=Text5.Text&vbCrLf  
EndIf  
NextSVcounter  
Text5.Text=Text5.Text&"};"&vbCrLf  
Text5.Text=Text5.Text&"unsignedintTB_CCR_C["&Str(Dimension)&"]={"&vbCrLf  
ForSVcounter=0ToDimension-1Step1  
Text5.Text=Text5.Text&Str(SV_PHC(SVcounter))&","  
IfSVcounterMod10=9Then  
Text5.Text=Text5.Text&vbCrLf  
EndIf  
NextSVcounter  
Text5.Text=Text5.Text&"};"&vbCrLf  
EndSub  
PrivateSubCommand2_Click()  
Open"SVresult.txt"ForOutputAs#1  
Print#1,Text5.Text  
Close#1  
EndSub  
PrivateSubText1_Change()  
EndSub  
PrivateSubTimer1_Timer()  
Cls  
Label9.Caption=Now  
EndSub  
PrivateSubForm_Load()  
SkinH_Attach  
Timer1.Interval=500  
Timer1.Enabled=True  
Label9.Caption=Now  
EndSub
0 0
原创粉丝点击