各位先進:
您們好,想跟大家詢問一個純粹扮演Listener角色的程式要如何撰寫
之前購買了一張 PCI-GPIB/TNT5004 的卡,裝上PC後串接到[Control PC-Tester-Handler]迴路中
使用GPIB Analyzer可以在測試過程中純粹監聽到訊息,而如果使用所附的sample code時
未什麼在初始化Device就會發生Error,Error Message 與Source code如下
想請教大家一個扮演純粹監聽角色的程式,有哪些設定值要預先設定與注意 Thanks!
Error Message:
Error opening device.
Ibsta:0x8100
REE:1<ECIC>
在 08-06-2012 04:01 AM
Dear Ting1224
透過GPIB Analyzer可以監聽到Tester與Handler的訊息,GPIB Analyzer設定資料畫面如附檔所附。
而透過下列的Code 為何無法監聽到如同GPIB Analyzer的訊息呢?謝謝您。
Imports NationalInstruments.NI4882 'must be included to reference the LangInt assembly
Imports VB = Microsoft.VisualBasic 'included for string manipulation
Module Module1
Const BDINDEX = 1 ' Board Index
Dim li As LangInt 'declare li of type LangInt that has all GPIB functions
Dim c As GpibConstants 'declare c of type GpibConstants that has all GPIB constants
Sub Main()
li = New LangInt 'declare an instance of li
c = New GpibConstants 'declare an instance of c
Dim noncontroller As Integer
Dim buffer As String
Dim panelHandle As Integer
Dim listen As Short
noncontroller = li.ibfind("gpib3")
'Release system control
li.ibrsc(noncontroller, 0)
li.ibpad(noncontroller, 13)
li.ibsad(noncontroller, 126)
li.ibtmo(noncontroller, c.T10s)
li.ibeot(noncontroller, 1)
li.ibeos(noncontroller, 0)
li.ibclr(noncontroller)
li.ibln(noncontroller, 13, 126, listen)
li.ibwait(noncontroller, 0)
'// Wait until non-controller is listener and ATN line is dropped.
While True
If ((li.ibsta And c.LACS) And (Not (li.ibsta And c.ATN))) Then
li.ibrd(noncontroller, buffer, 100) ' Read data bytes
End If
'If addressed to talk, send the response "I am a talker"
If ((li.ibsta And c.TACS) And (Not (li.ibsta And c.ATN))) Then
'// Send data across the bus.
li.ibwrt(noncontroller, "I am a talker", "I am a talker".Length)
End If
End While
End Sub
Best Regards
Robins
在 08-06-2012 04:25 AM
不好意思之前忘了提醒你, 這次才看到。
要使用GPIB Analyzer,你必須要有GPIB+的硬體才可以。
你可以參考以下連結
http://digital.ni.com/public.nsf/allkb/848F027883BD6429862571B8001DFEDC
To use the GPIB Analyzer you must have a GPIB+ interface, regular GPIB hardware does not have the analyzer hardware that is necessary.
GPIB+的硬體有以下這幾張
AT-GPIB/TNT+, PCI-GPIB+, and PCMCIA-GPIB+
在 08-09-2012 03:45 AM
Dear Ting1224:
謝謝你的提醒,目前已可以使用GPIB Analyzer 當成Listeners 在另一台
電腦,聽取到 Tester與Handle 間傳遞的訊息,詢息畫面在上一個所請教
的問題裡有附上圖片。另外想跟您請教,上一個所請教的問題所附的
Source Code哪那一個所下的指令所做的設定應該需要修改,
才能讓這個程式在另外一台電腦上扮演Listeners的角色,
接收到Tester與Handle 的訊息間傳遞的訊息,謝謝您。
Best Regards
Robins
在 03-31-2017 12:30 AM
您好,
我用C# 開發GPIB+的程式,
請問我要如何知道GPIB+ BUFFER上的資料是PC端還是儀器端傳來的??