资源描述:
《vb上位机温度采集(含源程序)》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、VB程序OptionExplicitDimNowXAsIntegerDimMaxPlotNoAsLongDimPreValueAsSinglePrivateSubcmbCOM_Click()IfcmbCOM.ListIndex+1=MSComm1.CommPortThenExitSubTimer1.Enabled=FalseTimeDelay100IfMSComm1.PortOpenThenMSComm1.PortOpen=FalseEndIflblMsg.Caption="已停止检测并关闭通讯端口"cm
2、dOpenCOM.Enabled=TrueEndSubPrivateSubcmdEnd_Click()EndEndSubPrivateSubcmdOpenCOM_Click()IfcmbCOM.ListIndex>=0AndcmbCOM.ListIndex<=16ThenMSComm1.CommPort=cmbCOM.ListIndex+1ElseMsgBox"指定通信端口时发生错误!",vbCritical+vbOKOnly,"系统信息"ExitSubEndIfOnErrorGoTocomErrMSCo
3、mm1.Settings="9600,n,8,1"MSComm1.PortOpen=TruecmdOpenCOM.Enabled=FalsecmdStart.Enabled=TruelblMsg.Caption="可单击【开始检测】按钮,执行检测的工作。"ExitSubcomErr:MsgBox"打开通信端口时发生错误!请确定通信端口存在且正常。",vbCritical+vbOKOnly,"系统信息"EndSubPrivateSubcmdStart_Click()Timer1.Enabled=NotTim
4、er1.EnabledIfTimer1.EnabledThencmdStart.Caption="停止检测"ElsecmdStart.Caption="开始检测"lblMsg.Caption="已停止检测"EndIfEndSubPrivateSubForm_Load()Dimi%MaxPlotNo=100cmbCOM.ClearcmbCOM.AddItem"COM1"cmbCOM.AddItem"COM2"cmbCOM.AddItem"COM3(USB)"cmbCOM.AddItem"COM4(USB)"
5、cmbCOM.AddItem"COM5"cmbCOM.AddItem"COM6"cmbCOM.AddItem"COM7"cmbCOM.AddItem"COM8"cmbCOM.AddItem"COM9"cmbCOM.AddItem"COM10"cmbCOM.AddItem"COM11"cmbCOM.AddItem"COM12"cmbCOM.AddItem"COM12"cmbCOM.AddItem"COM14"cmbCOM.AddItem"COM15"cmbCOM.AddItem"COM16"cmbCOM.L
6、istIndex=0cmdStart.Enabled=False'以下设定绘图范围,(Xmin,YMax)-(XMax,YMin)picVoltage.Scale(0,50)-(MaxPlotNo,0)picVoltage.DrawWidth=2'使用两个像素宽度的画笔EndSubPrivateSubLabel2_Click()EndSubPrivateSublblValue_Click()EndSubPrivateSubMSComm1_OnComm()EndSubPrivateSubTimer1_Tim
7、er()DimBuf$,ValueStrAsSingle,Pos1%Buf$=Buf$+MSComm1.InputTimeDelay2150ValueStr=Val(Mid(Buf,Pos1+1,7))lblValue.Caption=Format(ValueStr,"00.0000")&"℃"IfNowX=0ThenpicVoltage.ClspicVoltage.PSet(0,ValueStr)ElseIfValueStr>PreValue+0.01ThenpicVoltage.Line-(NowX,
8、ValueStr),RGB(255,0,0)ElsepicVoltage.Line-(NowX,ValueStr),RGB(0,0,255)EndIfEndIfPreValue=ValueStrNowX=NowX+1IfNowX>MaxPlotNoThenNowX=0EndSub总黄酮生物总黄酮是指黄酮类化合物,是一大类天然产物,广泛存在于植物界,是许多中草药的有效成分。在自然界中最常见的是黄酮和黄酮醇,其它包括双氢黄(醇)、