从C#/。

发布于 2025-01-23 06:19:21 字数 1079 浏览 0 评论 0原文

我正在尝试使用Ni-Visa / IVI库中的Teledyne Lecroy WaveSurfer 3054范围加载波形。我可以连接到范围并读取和设置控制变量,但是我无法弄清楚如何将跟踪数据从范围中恢复到我的代码中。我正在使用USBTMC,可以在Lecroy自动化手册中运行示例代码,但它没有给出获取波形阵列数据的示例,只需控制变量即可。他们没有ivi.net的驱动程序。这是代码的蒸馏版本:

        // Open session to scope
        var session = (IMessageBasedSession)GlobalResourceManager.Open
                            ("USB0::0x05FF::0x1023::LCRY3702N14729::INSTR");
            session.TimeoutMilliseconds = 5000;
            session.Clear();


            // Don't return command header with query result
            session.FormattedIO.WriteLine("COMM_HEADER OFF");

            //  {  other setup stuff that works OK  }
            //    ...
            //    ...


            //  Attempt to query the Channel 1 waveform data
          session.FormattedIO.WriteLine("vbs? 'return = app.Acquisition.C1.Out.Result.DataArray'");

因此,上面的最后一行(似乎是手册建议的)会引起哔哔声,并且没有可以读取的数据。我已经尝试了所有读取功能,并且它们一定超时,没有返回数据。如果我查询数据点的数量,我会得到100002,这似乎是正确的,我知道数据必须在那里。是否有更好的VBS查询可以使用?我是否可以使用读取功能将数据读取到我忽略的字节数组中?由于缓冲区大小的限制等,我是否需要在块中读取数据?我希望有人以前解决了这个问题。非常感谢!

I am trying to load a waveform from a Teledyne Lecroy Wavesurfer 3054 scope using NI-VISA / IVI library. I can connect to the scope and read and set control variables but I can't figure out how to get the trace data back from the scope into my code. I am using USBTMC and can run the sample code in the Lecroy Automation manual but it does not give an example for getting the waveform array data, just control variables. They do not have a driver for IVI.NET. Here is a distilled version of the code:

        // Open session to scope
        var session = (IMessageBasedSession)GlobalResourceManager.Open
                            ("USB0::0x05FF::0x1023::LCRY3702N14729::INSTR");
            session.TimeoutMilliseconds = 5000;
            session.Clear();


            // Don't return command header with query result
            session.FormattedIO.WriteLine("COMM_HEADER OFF");

            //  {  other setup stuff that works OK  }
            //    ...
            //    ...


            //  Attempt to query the Channel 1 waveform data
          session.FormattedIO.WriteLine("vbs? 'return = app.Acquisition.C1.Out.Result.DataArray'");

So the last line above (which seems to be what the manual suggests) causes a beep and there is no data that can be read. I've tried all the read functions and they all time out with no data returned. If I query the number of data points I get 100002 which seems correct and I know the data must be there. Is there a better VBS query to use? Is there a read function that I can use to read the data into a byte array that I have overlooked? Do I need to read the data in blocks due to a buffer size limitation, etc.? I am hoping that someone has solved this problem before. Thanks so much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我不在是我 2025-01-30 06:19:21

这是我在使其正常工作的第一项努力:

  var session = (IMessageBasedSession)GlobalResourceManager.Open("USB0::0x05FF::0x1023::LCRY3702N14729::INSTR");
  session.TimeoutMilliseconds = 5000;
  session.Clear();

  // Don't return command header with query result
  session.FormattedIO.WriteLine("COMM_HEADER OFF");

  //
  // .. a bunch of setup code...
  //

  session.FormattedIO.WriteLine("C1:WF?");      // Query waveform data for Channel 1
  buff = session.RawIO.Read(MAX_BUFF_SIZE);     // buff has .TRC-like contents of waveform data

Buff []字节缓冲区最终将获得与范围保存为磁盘的.TRC文件相同的文件格式化数据,因此必须对其进行解析。但是至少波形数据在那里!如果有更好的方法,我可能会发现并发布它,或者其他人可以随时发布它。

Here is the first effort I got at making it work:

  var session = (IMessageBasedSession)GlobalResourceManager.Open("USB0::0x05FF::0x1023::LCRY3702N14729::INSTR");
  session.TimeoutMilliseconds = 5000;
  session.Clear();

  // Don't return command header with query result
  session.FormattedIO.WriteLine("COMM_HEADER OFF");

  //
  // .. a bunch of setup code...
  //

  session.FormattedIO.WriteLine("C1:WF?");      // Query waveform data for Channel 1
  buff = session.RawIO.Read(MAX_BUFF_SIZE);     // buff has .TRC-like contents of waveform data

The buff[] byte buffer will end up with the same file formatted data as the .TRC files that the scope saves to disk, so it has to be parsed. But at least the waveform data is there! If there is a better way, I may find it and post, or someone else feel free to post it.

撧情箌佬 2025-01-30 06:19:21

我实现这一目标的方法是将屏幕截图保存到本地驱动器。将本地驱动器映射到当前系统&只需使用file.copy()将图像文件从映射驱动器复制到本地计算机。它节省了解析数据&如果使用类似TRC的内容,请重新绘制它。

The way I achieved this is by saving the screenshot to a local drive. Map the local drive to the current system & simply use File.Copy() to copy image file from the mapped drive to the local computer. It saves time to parse data & re-plot it if one uses TRC-like contents.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文