串口接收程序.docx

上传人:夺命阿水 文档编号:933034 上传时间:2024-01-18 格式:DOCX 页数:25 大小:76KB
返回 下载 相关 举报
串口接收程序.docx_第1页
第1页 / 共25页
串口接收程序.docx_第2页
第2页 / 共25页
串口接收程序.docx_第3页
第3页 / 共25页
串口接收程序.docx_第4页
第4页 / 共25页
串口接收程序.docx_第5页
第5页 / 共25页
点击查看更多>>
资源描述

《串口接收程序.docx》由会员分享,可在线阅读,更多相关《串口接收程序.docx(25页珍藏版)》请在课桌文档上搜索。

1、VERSION5.00Object=648A5603-2C6E-101B-82B6-000000000014#l.l#0;MSCOMM32.OCXObject=5E9E78A0-531B-llCF-91F6-C2863C385E30#1.0#0;MSFLXGRD.OCXBeginVB.FormFormlCaption=”西安亚川电力科技有限公司火灾报警器调试”CIientHeight=9660CIientLeft=60CIientTop=510CIientWidth=11625LinkTopic=FormlScaIeHeight=9660ScaIeWidth=11625StartUpPosit

2、ion=3,窗口缺省BeginVB.FrameFrame8Caption=”校验上限”Height=975Left=240Tabindex=74Top=8520Width=11175BeginVB-CommandButtonCommand35Caption=”校验C相电流”Height=380Left=9840Tabindex=82Top=360Width=1125EndBeginVB-CommandButtonCommand34Caption=校验漏电流”Height=380Left=240Tabindex=81Top=360Width=1125EndBeginVB-CommandButto

3、nCommand33Caption=”校验1路温度”Height=380Left=1600Tabindex=80Top=360Width=1125BeginVB-CommandButtonCommand32Caption=校验2路温度”Height=380LeftTabindexTopWidthEnd=2950=79=360=1125BeginVB-CommandButtonCommand31Caption=校验3路温度”Height=380LeftTabindexTopWidthEnd=4300=78=360=1125BeginVB-CommandButtonCommand30Caption

4、=校验4路温度”Height=380LeftTabindexTopWidthEnd=5650=77=360=1125BeginVB-CommandButtonCommand29Caption=校验A相电流,HeightLeftTabindexTopWidthEnd=380=7060=76=360=1125BeginVB-CommandButtonCommand28Caption=校验B相电流”HeightLeftTabindexTopWidthEndEnd=380=8480=75=360=1125BeginVB-CommandButtonCommand27Caption=校验C相电流”Heig

5、ht=380Left=IOlOOTabindex=73Top=7680Width=1125EndBeginVB.FrameFrame7Caption=“校验上限”Height=975Left=240Tabindex=65Top=7440Width=11175BeginVB-CommandButtonCommand26Caption=”校验B相电流”Height=380Left=8480Tabindex=72Top=360Width=1125EndBeginVB-CommandButtonCommand25Caption=”校验A相电流”Height=380Left=7060Tabindex=7

6、1Top=360Width=1125EndBeginVB-CommandButtonCommand24Caption=”校验4路温度”Height=380Left=5650Tabindex=70Top=360Width=1125EndBeginVB-CommandButtonCommand23Caption=”校验3路温度”Height=380Left=4300Tabindex=69Top=360Width=1125BeginVB-CommandButtonCommand22Caption=”校验2路温度UHeight=380Left=2950Tabindex=68Top=360Width=1

7、125EndBeginVB-CommandButtonCommand21Caption=”校验1路温度”Height=380Left=1600Tabindex=67Top=360Width=1125EndBeginVB-CommandButtonCommand20Caption=”校验漏电流”Height=380Left=240Tabindex=66Top=360Width=1125EndEndBeginVB.FrameFrame6Caption=数据采集Height=22951.eft=7680Tabindex=55Top=4800Width=3855BeginVB-CommandButto

8、nCommandl7Caption=采集A相电流Height=3801.eft=120Tabindex=64Top=1560Width=1125EndBeginVB-CommandButtonCommandl8Caption=采集B相电流Height=3801.eft=1350Tabindex=63Top=1560Width=1125EndBeginVB-CommandButtonCommandl9Caption=”采集C相电流”Height=380Left=2565Tabindex=62Top=1560Width=1125EndBeginVB-CommandButtonCommandl6Ca

9、ption=”采集4路温度UHeight=380Left=2560Tabindex=61Top=960Width=1125EndBeginVB-CommandButtonCommandlSCaption=”采集3路温度”Height=380Left=1350Tabindex=60Top=960Width=1125EndBeginVB-CommandButtonCommandl4Caption=”采集1路温度”Height=380Left=2560Tabindex=59Top=360Width=1125EndBeginVB-CommandButtonCommandl3Caption=”采集2路温

10、度”Height=380Left=120Tabindex=58Top=960Width=1125BeginVB-CommandButtonCommandl2Caption=”采集开关量Height=380Left=1350Tabindex=57Top=360Width=1125EndBeginVB-CommandButtonCommandllCaption=采集漏电流Height=380Left=120Tabindex=56Top=360Width=1125EndEndBeginVBJextBoxtxtReceivedTextHeight=810Left=6960MuItiLine=-1Tru

11、eScroIIBars=2VerticalTabindex=52Top=2160Width=4275EndBeginVB-CommandButtonCommand9Caption=“清除”Height=380Left=6260Tabindex=50Top=6000Width=100OEndBeginVBTextBoxttStartHeight=375Left=1230Tabindex=47Top=6000Width=855EndBeginVB.FrameFrame5Caption=“发送”Height=1575Left=240Tabindex=39Top=5760Width=7215Begin

12、VB-OptionButtonOptCommDataCaption=“文本(&X)”Height=180Index=1Left=120Tabindex=86Top=IllOWidth=1035EndBeginVB-OptionButtonOptCommDataCaption三“十六进制Height=180Index=OLeft=120Tabindex=85Top=840Width=1050EndBeginVB-CheckBoxChkCheckSumCaption=”校验和”Height=330Left=1920Tabindex=84Top=280Width=945EndBeginVB1Comm

13、andButtoncmdSendCaption=”发送“Height=380Left=4920Tabindex=54Top=240Width=1000EndBeginVBTextBoxtxtSendHeight=570Left=1320MuItiLine三-1TrueScroIIBars三2VerticalTabindex=51TopWidthEnd=840=5595BeginVB.TextBoxtxtEndHeight1.eft=375=3960Tabindex=49TopWidthEnd=240=855BeginVB.LabelLabellCaptionHeightIndexLeft=”前

14、段标志:”=255=4=120Tabindex=41TopWidthEnd=360=1095BeginVB.LabelLabellCaptionHeightIndexLeftTabindex=,结束标志:”=255=1=3000=40TopWidthEndEnd=360=1215BeginVB.FrameFrame4Caption=Height=1.eft=Tabindex=”接收数据”3015684038Top=Width=1204575BeginVB.TextBoxtxtReceivedBinaryHeight1.eftMuItiLine=ScroIIBars=Tabindex=810=1

15、20-1True2Vertical=53TopWidth=840=4275EndBeginVB.CommandButtoncmdClearCaption=Height=”清除U380Left=3360Tabindex=Top=Width=End442401000BeginVB.CommandButtonCmdCSCaption=CS,Height=3801.eft=2280Tabindex=Top=Width=End432401000BeginVB.CommandButtonCmd485Caption=485Height=380Left=Tabindex=120042Top=Width=End

16、2401000BeginVBlabeILabellCaption=Height=Index=1.eft=”文本信息:3756120Tabindex=46Top=Width=End18001095BeginVBlabeILabellCaption=二进制信息:Height=Index=1.eft=Tabindex=375512045Top=Width=End3501095BeginVB.CommandButtoncmdCloseCaption=Height=1.eft=Tabindex=Top=Width=End”关闭串口”3806240375040100OBeginVB.CommandButt

17、onCmdCommOpenCaption=Height=1.eft=Tabindex=Top=Width=End”打开串口”38050403650401000BeginVB.FrameFrame3Caption=Height=1.eft=Tabindex=Top=Width=”端口设置”8552403148007215BeginVB.ComboBoxCombo2HeightLeftTabindexTopWidthEnd=300=3120=32=300=1455BeginVB.ComboBoxCombolHeightLeftTabindexTextTopWidthEnd=300=950=33=c

18、boCommPort=300=735BeginVBlabeILabellCaptionHeightIndex1.eftTabindex=端口:,=255=3=360=83Top=360Width=615EndBeginVBlabeILabellCaption=数据格式(F):Height=255Index=21.eft=1920Tabindex=35Top=360Width=1215EndBeginVBlabeILabell7Caption=端口(P):Height=2551.eft=0Tabindex=34Top=840Width=855EndEndBeginVB.FrameFrame2Ca

19、ption=电流统计计算Height=13351.eft=5280Tabindex=18Top=3360Width=4860BeginVBJextBoxText8Height=3801.eft=1000Tabindex=22Top=260Width=1000EndBeginVBJextBoxText7Height=3801.eft=3450Tabindex=21Top=240Width=1000EndBeginVBTextBoxText6Height=380Left三3450Tabindex三20Top三720Width三1000EndBeginVBJextBoxText5Height=380

20、Left=1000Tabindex=19Top=735Width三1000EndBeginVB.LabelLabell6Caption三”漏电流Height三375Left=240Tabindex二30Top三360Width三855EndBeginVBlabeILabeIlSCaption三mAHeight=255Left三2100Tabindex=29Top=360Width二375EndBeginVBlabeILabel14Caption三A相电流:Height三375Left=2640Tabindex=28Top=360Width三855EndBeginVB.LabelLabell3C

21、aption三AHeight=255Left三4550Tabindex三27Top=360Width三255BeginVB.LabelLabell2CaptionHeight=C相电流:=3751.eft=2640TabindexTopWidthEnd=26=840=855BeginVB.LabelLabelllCaption=AHeightLeftTabindexTopWidthEnd=255=2100=25=840=375BeginVB.LabelLabeIlOCaption=B相电流:Height=3751.eft=240TabindexTopWidthEnd=24=840=855Beg

22、inVB.LabelLabel9CaptionHeightLeftTabindexTopWidthEndEnd=A=255=4550=23=840=255BeginVBtCommandButtonCommand3Caption=Height=1.eft=Tabindex=Top=Width=End“关闭软件”380103201743201000BeginVB1CommandButtonCommand2Caption=Height=“停止采集”380Left=10320Tabindex=16Top=3840Width=1000EndBeginVB1CommandButtonCommandlCap

23、tion=采集线性”Height=380Left=10320Tabindex=15Top=3360Width=1000EndBeginVB.FrameFramelCaption=”温度统计计算,Height=1335Left=200Tabindex=2Top=3360Width=4860BeginVBTextBoxText4Height=3801.eft=100OTabindex=10Top=735Width=1000EndBeginVBJextBoxText3Height=3801.eft=3360Tabindex=9Top=720Width=1000EndBeginVBTextBoxTex

24、t2Height=3801.eft=3360Tabindex=7Top=240Width=1000EndBeginVBTextBoxTextlHeight=3801.eft=1000Tabindex=4Top=260Width=1000EndBeginVB.LabelLabel8Caption三IlChHeight三255Left三4440Tabindex=14Top=840Width=375EndBeginVB.LabelLabel7Caption=”最小值Height=375Left三240Tabindex=13Top=840Width=855EndBeginVB.LabelLabel6C

25、aption三11C11Height三255Left二2100Tabindex=12Top=840Width三375EndBeginVB.LabelLabel5Caption=”最大值:”Height=375Left三2640Tabindex=11Top=840Width三855EndBeginVB.LabelLabel4Caption=IloQIlHeight=255Left=4440Tabindex=8Top=360Width三375BeginVB.LabelLabel2Caption二”平均值Height=375Left=2640Tabindex=6Top=360Width=855End

26、BeginVB.LabelLabel3Caption=IlC11Height=255Left=2100Tabindex=5Top=360Width=375EndBeginVB.LabelLabellCaption=”当前值:Height=375Index=0Left三240Tabindex=3Top三360Width-855EndEndBeginVB.TimerTimerlLeft=7320Top=5640EndBeginMSFIexGridLib.MSFIexGridMSFIexGridlHeight=30001.eft=4560Tabindex=1Top=240Width=2085_Ext

27、entX=3678_ExtentY=5292.Version=393216Rows=200EndBeginMSCommLib-MSCommMSComml1.eft=7320Top=6240_ExtentX=1005_ExtentY=1005_Version=393216DTREnabIe=-1TrueEndBeginVB1PictureBoxPicturelBackCoIor=&HOOFFFFFF&Height=3000Left=200ScaIeHeight=2940ScaIeWidth=4080Tabindex=0Top=240Width=4140EndBeginVB.LabelLabel2

28、3Caption=”校验和”Height=255Left=4200Tabindex=48Top=6120Width三1215EndEndAttributeVB_Name=FormlAttributeVB_GlobalNameSpace=FalseAttributeVB_Creatable=FalseAttributeVB_Predeclaredld=TrueAttributeVB_Exposed=False*西安亚川电力科技有限公司,火灾报警器调试软件,发布日期:2011/)6/16,描述:FY900火灾监控器专用调试软件,网站:,网站:e-mail:yachuandianlie-mail:y

29、achuandianliOICQ:029-85368687*木*本*本*,定义窗体级变量,在显示、绘图、报警等过程中使用Dimdatatemp(1000)AsSingle,用于存储温度采样值DimnumAsInteger用于存储采样值个数DimIAsSingleOptionExplicitPrivateDeclareFunctionGetTickCountLibkernel32()AsLongPrivateSubPicture2_Click()EndSubPrivateSubSubWizardl_GotFocus()EndSubPrivateSubCmd485_Click()IfIndex=O

30、ThenCboCommSettings=1200,E,8,1”txtSend.Text=68OlOOOO00000068Ol0243C3chkCheckSum.Value=VbCheckedtxtEnd.Text=16txtStart.Text=,OptCommData(O)1VaIue=TrueElseCboCommSettings=300,E,7zltxtSend.Text=2F3F21DAchkCheckSum.Value=VbUncheckedtxtEnd.Text=,txtStart.Text=OptCommData(O),VaIue=TrueEndIfEndSubPrivateSu

31、bcmdClear_Click()txtReceivedBinary.Text=,txtReceivedText.Tet=txtSend.SetFocusEndSubPrivateSubcmdClose_Click()CIoseCommEndSubPrivateSubcmdCommOpen_Click()SetMP11CIoseCommOnErrorResumeNextWithMSComml.CommPort=Val(Mid(cboCommPort.Text,4).Settings=cboCommSettings.Text.PortOpen=TrueIfErr=OThenCmdSend.Ena

32、bIed=TrueElseMsgBox错误信息:&vbCrLf&vbCrLf&Error&Space(7),VblnformationEndIfEndWithSetMPOEndSubPrivateSubcmdSend_Click()Dimarr()AsByteDimIAsLongDimJAsLongDimSAsLongDimCAsLongDimMsg(2)AsStringSetMP11CmdSend-EnabIed=FalseOnErrorResumeNextMsg(O)=txtStart.TextMsg(I)=txtSend.TextMsg(2)=txtEnd.TextForI=OTb2If

33、1=2ThenIfchkCheckSum.Value=VbCheckedThen数据字节校验和C=C+1ReDimPreservearr(C-1)arr(C-l)=SMod256EndIfEndIfIf(I=1)AndOptCommData(I),VaIueThen,文本方式DoWhileLen(Msg(l)OC=C+1ReDimPreservearr(C-1)arr(C-1)=Asc(Msg(l)IfI=IThenS=S+arr(C-1)Msg(I)=Mid(Msg(l),2)1.oop日Se十六进制Msg(I)=Trim(Msg(l)DoWhileLen(Msg(l)0C=C+1ReDim

34、Preservearr(C-1)arr(C-1)=Val(&H&Left(MsgfI),2)IfI=IThenS=S+arr(C-1)Msg(I)=Trim(Mid(Msg(l),3)1.oopEndIfNextIIfC0ThenMSComml.Output=arr()IfErrOThenMsgBox错误信息:&vbCrLf&vbCrLf&Error&Space(7)zVblnformationtxtSend.SetFocuscmdSend.Enabled=TrueSetMPOEndSubPrivateSubCombol_Change()CIoseCommEndSubPrivateSubCom

35、bo2_Change()CIoseCommEndSub开始采集PrivateSubCommandl_Click()Timerl.Enabled=TrueEndSubPrivateSubCommandlO_Click()Dimarr()AsByteDimIAsLongDimJAsLongDimSAsLongDimCAsLongDimMsg(2)AsStringSetMP11cmdSend.Enabled=FalseOnErrorResumeNextMsg(O)=txtStart.TextMsg(I)=txtSend.TextMsg(2)=txtEnd.TextForI=0To2If1=2Then

36、IfchkCheckSum.Value=VbCheckedThen,数据字节校验和C=C+1ReDimPreservearr(C-1)arr(C-l)=SMod256EndIfEndIfIf(I=1)AndOptCommData(I)VaIueThen,文本方式DoWhileLen(Msg(l)OC=C+1ReDimPreservearr(C-1)arr(C-1)=Asc(Msg(l)IfI=IThenS=S+arr(C-1)Msg(I)=Mid(Msg(l),2)1.oop日Se十六进制Msg(I)=TrimfMsg(I)DoWhileLen(Msg(l)OC=C+1ReDimPreservearr(C-1)arr(C-1)=Val(&H&Left(MsgfI(z2)IfI=IThenS=S+arr(C-1)Msg(I)=Trim(Mid(Msg(l),3)1.oopEndIfNextIIfCOThenMSComml.Output=arr()IfErrOThenMsgBox错误信息:&vbCrLf&vbCrLf&Error&Space(7),VblnformationtxtSend.SetFocuscmdSend.Enabled=TrueSetMPOEndSub停止采集PrivateSubCommand2_Click()Timerl-Enabled=Fa

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 在线阅读 > 生活休闲


备案号:宁ICP备20000045号-1

经营许可证:宁B2-20210002

宁公网安备 64010402000986号