GpListenAsync

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

 

 

image\head10.gif Operation             Asynchronous reception is executed.

 

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(xxxx) As Byte ' (xxxx specifies the maximum amount of data)

Ret = GpListenAsync(Cmd, Srlen, Srbuf)

 

(C)

DWORD Srlen, Ret;

DWORD * Cmd;

char * Srbuf;

Ret = GpListenAsync(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.ListenAsync(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.GpListenAsync(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)

 

pRecMem  : Pointer for receive buffer

 

Ret        :    Return value

0     :   Normal completion

80    :  GpIni() hasn't execute

140  :  Asynchronous function is executing now

190  :  Cannot create the Event object

200  :  Cannot create new thread

 

'ErrCode' of GpCheckAsync()

0      :   Normal completion(Delimiter received)

1      :   Normal completion(Delimiter and EOI received)

2      :   Normal completion(EOI received)

128   :   Receive data overflow

141   :   Stop by GpStopAsync()

240   :   ESC key pressed

242   :   Miss in address specified

243   :   Miss in buffers

252   :   GPIB error

253   :   There is no receive data (Delimiter only)

254   :   Timeout

255   :   Illegal call

(See "Return Values" for details.)

 

image\head10.gif Notes

1  The completion of the reception ismonitored with GPCheckAsync().
When it is finished normally, return value of GpCheckAsync() is 0 and ErrCode  (2nd parameter) becoms less than 2 or 128.

 

2  The return value of 1/2/128/141/240/242/252/254 and 255 are not returned directly from this function.
These values are returned to 'ErrCode' that is 2nd parameter of GpCheckAsync().

 

3  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.

 

4  About Command array :

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

 

5  When receive data overflow error(Master mode) :

  1)Execute GpListenAsync

  2)The value of 'ErrCode' that is 2nd parameter of GpCheckAsync() is 128.

  3)Set cmd(0)=0 and GpListenAsync again.

  4)Repeat (3) until return value of 'ErrCode'(lower byte) turned less 2.