設定例

VB.NET用

Dim Ret, Srlen, Cmd(31) As Integer

Dim ErrCode As Integer

Dim Srbuf() As Byte = System.Text.Encoding.ASCII.GetBytes("*IDN?")

Cmd(0) = 3   ' トーカ+リスナ数(マスタモード時)

Cmd(1) = 1   ' トーカアドレス

Cmd(2) = 3   ' リスナアドレス

Cmd(3) = 7   ' 〃

Srlen = Srbuf.Length   ' 送信バイト長

Ret = GpTalkAsync(Cmd, Srlen, Srbuf)

' 終了確認

While True

    Ret = GpCheckAsync(0, ErrCode)

    If (Ret != 140) Then

        Exit While

    End If

End While

 

C言語用

DWORD Ret, Srlen, Cmd[31];

DWORD ErrCode;

BYTE Srbuf[10];

Cmd[0] = 3;   /* トーカ+リスナ数(マスタモード時)*/

Cmd[1] = 1;   /* トーカアドレス */

Cmd[2] = 3;   /* リスナアドレス */

Cmd[3] = 7;   /* 〃 */

lstrcpy((char*)Srbuf, "*IDN?");   /* 送信データ */

Srlen = lstrlen((char*)Srbuf);   /* 送信バイト長 */

Ret = GpTalkAsync(Cmd, &Srlen, Srbuf);

/* 終了確認 */

while (TRUE) {

Ret = GpCheckAsync(0, &ErrCode);

   if (Ret != 140) {

break;

}

}

 

C#用

uint Ret, Srlen;

uint[] Cmd = new uint[31];

uint ErrCode;

string Srbuf;

Cmd[0] = 3;   /* トーカ+リスナ数(マスタモード時)*/

Cmd[1] = 1;   /* トーカアドレス */

Cmd[2] = 3;   /* リスナアドレス */

Cmd[3] = 7;   /* 〃 */

Srbuf = "*IDN?";   /* 送信データ */

Srlen = Srbuf.Length;   /* 送信バイト長 */

Ret = gpib.TalkAsync(Cmd, out Srlen, Srbuf);

/* 終了確認 */

while (TRUE) {

    Ret = gpib.CheckAsync(0, out ErrCode);

    if (Ret != 140) {

        break;

    }

}

 

Python用

Ret, Srlen, Cmd = ctypes.c_ulong(), ctypes.c_ulong(), (ctypes.c_ulong * 31)()

ErrCode = ctypes.c_ulong()

Srbuf = (ctypes.c_ubyte * 10)()

Cmd[0] = 3   # トーカ+リスナ数(マスタモード時)

Cmd[1] = 1   # トーカアドレス

Cmd[2] = 3   # リスナアドレス

Cmd[3] = 7   # 〃

Srlen.value = len("*IDN?".encode('UTF-8'))   # 送信バイト長

ctypes.memmove(Srbuf, "*IDN?".encode('UTF-8'), Srlen.value)   # 送信データ

Ret.value = GpibPy.GpTalkAsync(Cmd, ctypes.byref(Srlen), Srbuf)

# 終了確認

while True:

   Ret.value = GpibPy.GpCheckAsync(0, ctypes.byref(ErrCode))

   if Ret.value != 140:

      break