GpListenExBinary

image\BLTLRGSQ.gifBoards that Support the Function image\SETUP.gif image\SANBTN.gif

 

 

image\head10.gif Operation             Receives data. When receives binary data by VB, use GpListenExBinary.

 

image\head10.gif Format                 

(VB.NET)

Dim Srlen, Ret As Integer

Dim Cmd(xxxx) As Integer ' (xxxx specifies the maximum number of command arrays)

Dim Srbuf As New String("", xxxx) ' (xxxx specifies the maximum amount of data)

Ret = GpListenEx(Cmd, Srlen, Srbuf)

 

(C)

DWORD Srlen, Ret;

DWORD * Cmd;

char * Srbuf;

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

 

(C#)

uint Srlen, Ret;

uint[] Cmd = new uint[xxxx]; /* (xxxx specifies the maximum number of command arrays) */

StringBuilder Srbuf = new StringBuilder(xxxx); /* (xxxx specifies the maximum amount of data) */

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

 

(Python)

Srlen, Ret = ctypes.c_ulong(), ctypes.c_ulong()

Cmd = (ctypes.c_ulong * xxxx)() # (xxxx specifies the maximum number of command arrays)

Srbuf = (ctypes.c_ubyte * xxxx)() # (xxxx specifies the maximum amount of data)

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

 

image\head10.gif Mode                   Master mode/Slave mode

 

image\head10.gif Parameters          Cmd        :    Command array

[0] Number of talkers and listeners ( = Number of listeners+1)

(Slave mode = 0)

[1] Talker address

[2] Listener address

image\CONTINUE.gif

Srlen       :   (IN) Maximum data length in bytes that can be received(Max 1Mbytes)

(OUT) Receive data length in bytes

Srbuf       :    Receive buffer

SrbufB     :    Receive buffer(for binary)

Ret          :    Return value

0      :  Normal completion (Delimiter receive)

1      :  Normal completion (Delimiter and EOI receive)

2      :  Normal completion (EOI receive)

80    :  GpIni() hasn't execute

128  :  Receive data overflow

140  :  Asynchronous function is executing now

240  :  ESC key pressed

242  :  Miss in address specified

243  :  Miss in buffers

252  :  GP-IB error

253  :  There is no receive data (Delimiter only)

254  :  Timeout

255  :   Illegal call

(See "Return Values" for details.)

 

image\head10.gif Notes                   1  There is the following difference in comparison with GpListen().

2  Receive buffer and receive data length in bytes :

  Enter the number of arrays specified for Srbuf in Srlen. The output value in Srlen cannot exceed the input value in Srlen. If data exceeding that length arrives, Srlen (input value) becomes equal to Srlen (output value) and data up to bytes of Srlen (output value) will be put in Srbuf. Consequently, the program may not operate successfully if you enter for Srlen a value greater than the number of arrays in Srbuf.

3  About Command array :

  Since the number of commands to be sent is given to Cmd[0], specify 0 for Cmd[0] in slave mode.

4  When receive data overflow error(Master mode) :

  1. Set cmd(0)=0 and GpListen again.

  2. Repeat (1) until return value (lower byte) turned less 2.