如何解决从万用表获取数据的最佳方法,而不会冻结它直到另一个命令输入
我正在尝试修复一个使用 Ivi.Visa.Interop 的程序;当它提取信息时它会冻结。有没有更好的设置方法或让它自然发送数据的方法?现在它作为 gpib 命令运行。下面是带有读取循环的读取语句以使用该程序。此外,重置命令会将万用表设置为空白,直到收到读取命令为止。会不会有理由每次都重置?
while (stable == false)
{
//Thread is being used to time the readings as one second apart each.
DMMread = mydmm.readDCVStr();
PressStr = VC10Comm.VC10Chat.CurrentPressureStr();
AmbPressrtb.Text = PressStr;
Voltagertb.Text = DMMread;
Thread.Sleep(1000);
Application.DoEvents();
}
public string readDCVStr()
//Reads in measurement,can be slight delay in retreived string value
{
try
{
// mydmm.WriteString("MEAS:VOLT:DC? 25,0.001");
string VDC = mydmm.ReadString();
string temp= mydmm.ReadNumber();
Console.WriteLine(temp);
//The returned string is in scientific notation,//if the DMM is only reading in a single digit voltage range,this is fine
//if range is increas on the DMM to double digits (ex. 24V) string
//will need further manipulation to show and convert correct value
double VDCdouble = Double.Parse(VDC,System.Globalization.NumberStyles.Float);
VDC = VDCdouble.ToString();
return VDC + " V DC";
}
catch (Exception)
{
return "Failed to read measurement from DMM";
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。