Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VBAを用いてGPIBで測定器データ取得

エクセルマクロ(VBA)を用いて、GPIB(NI社GPIB-USB-HS)でHP社のインピーダンスアナライザ(4194A)を

制御させて、測定データの取得を試みております(GPIB,VBAともに初心者です)

 

データ取得にibrdコマンドを用いて、データ取得を試みております。

ibrdコマンドは読み込みバイト数を指定した引数を与えないとうまく動かないことを認識しております。
(http://digital.ni.com/public.nsf/ea4c5ba0c4c6fbfe86256a1e00676eb8/862567530005f0a1492568f9001952ba?O...


私の場合、測定ポイント数が多く、バイト数の限界を超えてしまいます。(データは801ポイントでカンマ区切りで出てきて、

下記マクロではデータの途中までしか取得できません)


何かほかの手段(コマンド)で、データを取得する方法はあるのでしょうか?
なにとぞ初心者ですので、皆様の知識をお借りしたいと思っております。ご教授お願いいたします。

 

<現在のマクロ>
Sub Macro1()
 Dim HP4194A As Integer
 Dim data As String * 1000
 
 HP4194A = ildev(0, 17, 0, 10, 1, 0)

 Call ibwrt(HP4194A, "A?")
 Call ibrd(HP4194A, data)
 Range("F8").value = data
End Sub

0 Kudos
Message 1 of 3
(10,134 Views)

partial translation:

 

I am trying to use the ibrd command in VBA to load data from a HP 4194A impedance analyzer using GPIB interface.  I am a beginner in both VBA and GPIB.

(not sure about the next part) 

I am aware that I need to indicate the correct number of read bytes when I use this command (link).  In my case, I have many points, and it is difficult to determine exactly how many read data points there are.  Is there another command I can use?  Many thanks.

I am guessing that Mr. Yama needs someone to look at the macro he has written and find a more elegant way to code it.

0 Kudos
Message 2 of 3
(10,125 Views)

S_Yama,

 

Yes, you have to specify a byte count but you do not need to determine exactly how many. When you do a read, the read will automatically terminate when the GPIB EOI line is asserted. So, you can request an arbitrary large number of bytes to read and not worry about. For example, for the *IDN? query, you could specify 2000 bytes and if the instrument returns 100, that is all that you will get.

 

For some requests, there might be a byte count that the instrument will make available but that is command and instrument specific. You need to read the manual.

0 Kudos
Message 3 of 3
(10,119 Views)