是德科技
直播中

李奂善

8年用户 198经验值
私信 关注
[问答]

基于mfgr驱动程序的测试系统冻结出错该怎么办?

我正在将基于mfgr驱动程序的测试系统转换为使用VISA I / O库。
系统已经可靠运行了5 - 6年,没有命令(SCPI)或时序结构发生变化,但是当我使用VISA库时,我在大约1500次操作时得到“VI_ERROR_SYSTEM_ERROR”,导致软件在2次尝试后冻结
恢复。
最常见的仪器是66311D电源
我知道这似乎是很多操作。
这些测试涉及16个DUT,100个测试和3个温度下的4个配置操作,以及在不同温度下对所有16个DUT进行100组测量,正如我之前所说,测试已经运行了几年。
一个DUT通常需要在一个温度下进行1000次仪器操作。
我使用的是Windows XP SP3,Agilent I / O Library 16.1,HP 66311D,HP 53181A,Aeroflex 2945B以及一些专有夹具。我无法在Internet或任何Agilent文档中找到相关参考。
任何帮助将不胜感激。

以上来自于谷歌翻译


     以下为原文

  I am converting a mfgr driver based test system to using the VISA I/O library. The system has worked reliably for 5-6 years
and none of the command (SCPI) or timing structure  has changed, but when I use the VISA library I get a "VI_ERROR_SYSTEM_ERROR" at about 1500 operations which causes the software to freeze after 2 tries to recover. The most common instrument involved is the 66311D power supply. I know this seems like a lot of operations. These tests involve 16 DUTs, 100 tests and 4 configuration operations at 3 temperatures and a group of 100 measurements at various temperatures for all 16 DUTs and as I indicated earlier the tests have been running for several years. One DUT typically requires 1000 instrument operations at one temperature. I am using Windows XP SP3, Agilent I/O Library 16.1, HP 66311D, HP 53181A, Aeroflex 2945B, and some proprietary fixtureing.
I have been unable to find a relevant reference on the Internet or in any Agilent documentation. Any help will be appreciated.  

回帖(12)

罗敏

2019-8-6 12:31:24
嗨,我有点困惑。
在VISA之前使用的IO库是什么?
你能发布给你带来麻烦的代码吗?

以上来自于谷歌翻译


     以下为原文

  Hi,

I am a little confused.  What was the IO library used before VISA?  Can you post the code that is giving you trouble?
举报

李奂善

2019-8-6 12:45:49
Thanks for the reply. Previous to to VISA the software ran on the driver supplied by the mfgr of the GPIB board, Measurements Computing.
Here's the code:

Function WriteToInstrument(tq_num%, cmd$, rd_delay&) As String
    'On Local Error GoTo errWrtInst
    Dim vi As Long                'Session to instrument
    Dim vi_status As Long
    Dim rSize As Long             'return byte count for read operation
    Dim strRes  As String
    Static viDFRM As Long     'Sessions of Default Resource Manager
    Static wti_count%
    'Debug.Print TQ_Model$(tq_num%) & " cmd$[" & cmd$ & "]"
    If wti_count% = 0 Then
        Track_VISA_Data "reset", whchInstr$, trkDFRM&, vi, trkStatus$, trkCmd$
        wti_count% = 1
    End If
    WriteToInstrument = "OK"
    sz% = -1
    Select Case tq_num%
        Case Is = AMM%
            If TQ_Address$(AMM%) = TQ_Address$(PWS%) Then
                tq_num% = PWS%
            End If
             If TQ_BusParameters$(tq_num%) = "GPIB" And InStr(cmd$, "?") Then
                sz% = CInt((pwsPoints% + 1) * 12)
                'Debug.Print RptLog$(tst_prc%) & " cmd$/sz%[" & cmd$ & "/" & sz% & "]"
                strRes = String(sz%, Chr$(32))
            Else
                strRes = String(200, Chr$(32))
            End If
        Case Else
            strRes = String(32, Chr$(32)) '200
    End Select
    If viDFRM = 0 Then
        If cmd$ "release" Then
            'Open the default resource manager session for valid devices
            Select Case TQ_BusParameters$(tq_num%)
                Case Is = "GPIB", "LAN", "LANtoGPIB", "LANtoMODBUS"
                    vi_status = viOpenDefaultRM(viDFRM)
                    Debug.Print "Open DRM " & "[" & viDFRM & "]"
                    If vi_status VI_SUCCESS Then
                        Track_VISA_Data "Open DRM", whchInstr$, viDFRM, vi, Hex(vi_status), Data_Filter(Trim(cmd$))
                        RptLog$(err_des%) = "Fail Open: Default Resource Manager session[" & Str(viDFRM) & "]"
                        WriteToInstrument = "VISA Error!"
                        viDFRM = 0
                        GoTo errWrtInst
                    End If
                Case Else 'RS232, PCI, USB
            End Select
        End If
    End If
    If cmd$ = "release" Then
        If viDFRM > 0 Then
            Debug.Print "Close " & TQ_Model$(tq_num%) & "[" & viDFRM & "]"
            vi_status = viClose(viDFRM)
            viDFRM = 0
            Exit Function
        Else
            Exit Function
        End If
    End If
    Select Case TQ_BusParameters$(tq_num%)
        Case Is = "GPIB"
            wti_count% = wti_count% + 1
            'Debug.Print RptLog$(tst_prc%) & " wti_count%[" & wti_count% & "]"
            'Open the session to the resource
            whchInstr$ = "GPIB1::" & TQ_Address$(tq_num%) & "::INSTR"
            vi_status = viOpen(viDFRM, whchInstr$, VI_NULL, VI_NULL, vi)
            trkDFRM& = viDFRM
            trkStatus$ = Hex(vi_status)
            trkCmd$ = Data_Filter(Trim(cmd$))
            Track_VISA_Data "open", whchInstr$, trkDFRM&, vi, trkStatus$, trkCmd$
            If vi_status VI_SUCCESS Then
                RptLog$(err_des%) = "viOpen session Failed[" & Hex(vi_status) & "][" & Format$(vi, "0") & "]"
                WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                viDFRM = 0
                GoTo errWrtInst
            End If
            'write to device - rd_delay& = 0 Then
                cmd$ = cmd$ & vbLf
                vi_status = viWrite(vi, cmd$, Len(cmd$), rSize)
                If vi_status VI_SUCCESS Then
                    RptLog$(err_des%) = "viWrite Failed[" & Hex(vi_status) & "]"
                    WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                    'Track_VISA_Data "viWrite", whchInstr$, trkDFRM&, vi, trkStatus$, trkCmd$
                    viDFRM = 0
                    GoTo errWrtInst
                End If
            Else
                rd_delay& = Abs(rd_delay&)
            End If
            'Read the results as a string.
            If InStr(cmd$, "?") And rd_delay& > 0 Then '11.09.02
                Sleep rd_delay&
                Select Case sz% 'tq_num%
                    Case Is > 0 '= AMM%
                        vi_status = viRead(vi, strRes, sz%, rSize)
                    Case Else
                        sz% = 64
                        vi_status = viRead(vi, strRes, sz%, rSize)
                End Select
                If vi_status VI_SUCCESS Then
                    trkDFRM& = viDFRM
                    trkStatus$ = Hex(vi_status)
                    trkCmd$ = Data_Filter(Trim(cmd$))
                    Track_VISA_Data "read", whchInstr$, trkDFRM&, vi, trkStatus$, trkCmd$
                    'If vi_status VI_SUCCESS_MAX_CNT Then
                    RptLog$(err_des%) = "viRead Failed[" & Hex(vi_status) & "] byte count[" & Format$(sz%, "0") & "/" & Format$(rSize, "0") & "]"
                    WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                    viDFRM = 0
                    GoTo errWrtInst
                End If
                'Debug.Print "strRes[" & strRes & "]"
                dat_str$ = strRes
                WriteToInstrument = Data_Filter(Trim(dat_str$))
            End If
            vi_status = viClose(vi)
            If vi_status VI_SUCCESS Then
                Track_VISA_Data "close vi", whchInstr$, trkDFRM&, vi, trkStatus$, trkCmd$
                RptLog$(err_des%) = RptLog$(err_des%) & " Fail close:[" & Str(viDFRM) & "]"
                WriteToInstrument = "VISA Error!"
            End If
            'If wti_count% >= 1500 Then
            '    vi_status = viClose(viDFRM)
            '    If vi_status VI_SUCCESS Then
            '        RptLog$(err_des%) = "Fail close:[" & Str(viDFRM) & "]"
            '        WriteToInstrument = "VISA Error!"
            '    End If
            '    viDFRM = 0
            '    wti_count% = 0
            'End If
        Case Is = "LAN"
            wti_count% = wti_count% + 1
            'Debug.Print RptLog$(tst_prc%) & " wti_count%[" & wti_count% & "]"
            'Open the session to the resource
            whchInstr$ = "TCPIP0::" & TQ_LanAddress$(tq_num%) & "::INSTR"
            vi_status = viOpen(viDFRM, whchInstr$, VI_NULL, VI_NULL, vi)
            trkDFRM& = viDFRM
            trkStatus$ = Hex(vi_status)
            trkCmd$ = Data_Filter(Trim(cmd$))
            'Track_VISA_Data "open", whchInstr$, trkDFRM&, vi, trkStatus$, trkCmd$
            If vi_status VI_SUCCESS Then
                RptLog$(err_des%) = "viOpen session Failed[" & Hex(vi_status) & "][" & Format$(vi, "0") & "]"
                WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                viDFRM = 0
                GoTo errWrtInst
            End If
            'write to device - rd_delay& = 0 Then
                cmd$ = cmd$ & vbLf
                vi_status = viWrite(vi, cmd$, Len(cmd$), rSize)
                If vi_status VI_SUCCESS Then
                    RptLog$(err_des%) = "viWrite Failed[" & Hex(vi_status) & "]"
                    WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                    'Track_VISA_Data "viWrite", whchInstr$, trkDFRM&, vi, trkStatus$, trkCmd$
                    viDFRM = 0
                    GoTo errWrtInst
                End If
            Else
                rd_delay& = Abs(rd_delay&)
            End If
            'Read the results as a string.
            If InStr(cmd$, "?") And rd_delay& > 0 Then '11.09.02
                Sleep rd_delay&
                Select Case sz% 'tq_num%
                    Case Is > 0 '= AMM%
                        vi_status = viRead(vi, strRes, sz%, rSize)
                    Case Else
                        sz% = 64
                        vi_status = viRead(vi, strRes, sz%, rSize)
                End Select
                If vi_status VI_SUCCESS Then
                    trkDFRM& = viDFRM
                    trkStatus$ = Hex(vi_status)
                    trkCmd$ = Data_Filter(Trim(cmd$))
                    'Track_VISA_Data "read", whchInstr$, trkDFRM&, vi, trkStatus$, trkCmd$
                    'If vi_status VI_SUCCESS_MAX_CNT Then
                    RptLog$(err_des%) = "viRead Failed[" & Hex(vi_status) & "] byte count[" & Format$(sz%, "0") & "/" & Format$(rSize, "0") & "]"
                    WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                    viDFRM = 0
                    GoTo errWrtInst
                End If
                'Debug.Print "strRes[" & strRes & "]"
                dat_str$ = strRes
                WriteToInstrument = Data_Filter(Trim(dat_str$))
            End If
            vi_status = viClose(vi)
            If vi_status VI_SUCCESS Then
                'Track_VISA_Data "close vi", whchInstr$, trkDFRM&, vi, trkStatus$, trkCmd$
                RptLog$(err_des%) = RptLog$(err_des%) & " Fail close:[" & Str(viDFRM) & "]"
                WriteToInstrument = "VISA Error!"
            End If
        Case Is = "LANtoGPIB" 'see Prologix note
            DoEvents
            'Open the session to the resource
            whchInstr$ = "TCPIP0::" & TQ_LanAddress$(tq_num%) & "::" & TQ_LanPort$(tq_num%) & "::SOCKET"
            vi_status = viOpen(viDFRM, whchInstr$, VI_NULL, VI_NULL, vi)
            If vi_status VI_SUCCESS Then
                RptLog$(err_des%) = "viOpen session Failed[" & Hex(vi_status) & "]"
                WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                vi_status = viClose(viDFRM)
                If vi_status VI_SUCCESS Then
                    RptLog$(err_des%) = RptLog$(err_des%) & " Fail close:[" & Str(viDFRM) & "]"
                    WriteToInstrument = "VISA Error!"
                End If
                viDFRM = 0
                GoTo errWrtInst
            End If
            DoEvents
            'write to device
            For n% = 1 To 3
                lan_msg$ = Choose(n%, "++addr " & TQ_Address$(tq_num%), "++auto 0", cmd$) & vbLf
                vi_status = viWrite(vi, lan_msg$, Len(lan_msg$), rSize)
                If vi_status VI_SUCCESS Then
                    RptLog$(err_des%) = "viWrite Failed[" & Data_Filter(Trim(lan_msg$)) & "/" & Hex(vi_status) & "]"
                    WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                    vi_status = viClose(viDFRM)
                    If vi_status VI_SUCCESS Then
                        RptLog$(err_des%) = RptLog$(err_des%) & " Fail close:[" & Str(viDFRM) & "]"
                        WriteToInstrument = "VISA Error!"
                    End If
                    viDFRM = 0
                    GoTo errWrtInst
                End If
                DoEvents
                Sleep 250
            Next n%
            If InStr(cmd$, "?") Then
                DoEvents
                Dim strLAN As String * 64
                Sleep rd_delay&
                lan_msg$ = "++read eoi" & vbLf
                vi_status = viWrite(vi, lan_msg$, Len(lan_msg$), rSize)
                If vi_status VI_SUCCESS Then
                    RptLog$(err_des%) = "viWrite/Read Failed[" & Data_Filter(Trim(lan_msg$)) & "/" & Hex(vi_status) & "][" & rd_delay& & "]"
                    WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                    vi_status = viClose(viDFRM)
                    If vi_status VI_SUCCESS Then
                        RptLog$(err_des%) = RptLog$(err_des%) & " Fail close:[" & Str(viDFRM) & "]"
                        WriteToInstrument = "VISA Error!"
                    End If
                    viDFRM = 0
                    GoTo errWrtInst
                End If
                DoEvents
                'Sleep 250
                vi_status = viRead(vi, strLAN, 64, rSize)
                If vi_status VI_SUCCESS Then
                    If vi_status VI_ERROR_TMO Then
                        'vi_status = viClose(vi)
                        viDFRM = 0
                        RptLog$(err_des%) = "viRead Failed[" & Hex(vi_status) & "]"
                        WriteToInstrument = "VISA Error!-tq_num%[" & Format$(tq_num%, "0") & "]"
                        vi_status = viClose(viDFRM)
                        If vi_status VI_SUCCESS Then
                            RptLog$(err_des%) = RptLog$(err_des%) & " Fail close:[" & Str(viDFRM) & "]"
                            WriteToInstrument = "VISA Error!"
                        End If
                        viDFRM = 0
                        GoTo errWrtInst
                    End If
                End If
                dat_str$ = Trim(strLAN) 'strRes
                'Debug.Print "    [" & Data_Filter(Trim(dat_str$)) & "]"
                WriteToInstrument = Data_Filter(Trim(dat_str$))
            Else
                WriteToInstrument = ""
            End If
            vi_status = viClose(vi)
        Case Is = "LANtoMODBUS"
        Case Else 'RS232, PCI, USB
            whchInstr$ = TQ_Model$(tq_num%)
            Select Case TQ_Model$(tq_num%)
                Case Is = "E3645A"
                    'Debug.Print "Write-TQ_Model$(tq_num%)[" & TQ_Model$(tq_num%) & "]"
                    dat_str$ = PWS_E3645A(cmd$)
                    WriteToInstrument = Data_Filter(Trim(dat_str$))
                Case Is = "USB-2527", "PCI-DAS1602/12"
                    If cmd$ = "*IDN?" Then
                        WriteToInstrument = TQ_Model$(tq_num%)
                    End If
            End Select
    End Select
Exit Function

errWrtInst:
    vi_status = viClose(vi) '11.09.16
    RptLog$(err_src%) = "WriteToInstrument[" & whchInstr$ & "]"
    RptLog$(err_idn%) = Data_Filter(Trim(cmd$))
    Test_Logs "visa"
End Function
举报

罗敏

2019-8-6 12:52:59
嗨,您每次写入仪器时都会调用此子程序吗?
如果是这样,我建议您打开和关闭仪器一次,而不是每次向它们写命令。
如果发生某些事情并且会话没有正确关闭,那么由于开放会话太多,您将开始崩溃。
如果你在程序开头打开一次,你将大大减轻这一点。
它还可以使您的程序工作更快,因为您不需要每次发送命令时都打开VISA会话。
你可以尝试一下,让我知道它是否有效?

以上来自于谷歌翻译


     以下为原文

  Hi,

Do you call this subroutine every single time that you write to the instrument?  If so, I would recommend that you open and close your instruments once instead of every single time you write a command to them.  If something happens and the session does not properly close, then you will start having crashes due to too many open session.  If you open this once in the beginning of your program, you will alleviate this greatly.  It will also make your program work a bit faster since you do not need to open a VISA session every single time you send a command.  Can you give this a try and let me know if it works?
举报

李奂善

2019-8-6 13:05:00
我试一试。
你建议我在资源管理器会话中只打开一次仪器会话。对我来说是合理的。
我的日子快结束了,所以在我报告之前可能是明天。谢谢。

以上来自于谷歌翻译


     以下为原文

  I'll give it a try. You're suggesting that I open the instrument session only once as I do the resource manager session.
Sounds reasonable to me. My day is nearly over so it will probably be tomorrow before I can report.

Thanks.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分