NI產品與技術 討論區

取消
顯示結果 
搜尋替代 
您的意思是: 

gpib

各位先進:

        您們好,想跟大家詢問一個純粹扮演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>

 

下載全部
0 積分
1 條訊息(共 7 條)
7,079 檢視

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

0 積分
3 條訊息(共 7 條)
7,048 檢視

不好意思之前忘了提醒你, 這次才看到。

要使用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+

 

 

0 積分
4 條訊息(共 7 條)
7,046 檢視

Dear Ting1224:

 

謝謝你的提醒,目前已可以使用GPIB Analyzer 當成Listeners 在另一台

電腦,聽取到 Tester與Handle 間傳遞的訊息,詢息畫面在上一個所請教

的問題裡有附上圖片。另外想跟您請教,上一個所請教的問題所附的

Source Code哪那一個所下的指令所做的設定應該需要修改,

才能讓這個程式在另外一台電腦上扮演Listeners的角色,

接收到Tester與Handle 的訊息間傳遞的訊息,謝謝您。

 

 

Best Regards

Robins

0 積分
5 條訊息(共 7 條)
7,032 檢視

li.ibrsc(noncontroller, 0) 就是把SC(System Controller)設成False (0)

 

noncontroller是原程式設計者定義GPIB3這張Board的Reference,
所以把noncontroller這張卡設為false代表這張卡為Listeners。

0 積分
6 條訊息(共 7 條)
7,023 檢視

您好,

我用C# 開發GPIB+的程式,

請問我要如何知道GPIB+ BUFFER上的資料是PC端還是儀器端傳來的??

0 積分
7 條訊息(共 7 條)
3,597 檢視