GpibReceive Procedure

Reads data bytes from a specified GPIB device.

Syntax

[ lBytesReceived = ] GpibReceive ( lDevice , sEOS , bEOI , lTimeoutmSec , [enMode], pDst [, lBytes ] )

The GpibReceive procedure syntax has the following parts:

 

Name

Type

Description

lBytesReceived

Long

Bytes actually received

lDevice

Val Long

Device address

sEOS

Val BString

End of sequence string

bEOI

Bool

Terminate on EOI

lTimeout

Val Long

Timeout in milliseconds

enMode

Val enumAIoMode

Input receive mode. The deafult is 0, aioDefault.

pDst

Var Any

Receive data buffer

lBytes

Val Long

Maximum number of bytes to receive. If the default value is used (-1) the byte length of the pDst data size is used as the maximum of bytes to receive. For an empty non-fixed size string 1024 bytes is used.

Where

bEOI can have one of the following values:

 

Value

Description

True *

Terminate the transmission on EOI line (End or Identify).

False

Ignore the EOI line.

enumAIoMode can have one of the following values:

 

Name

Value

Description

aioImmediate

0 *

Receive on data available

aioWaitGpibSrqVxiDor

1

Receive on Srq (gpib) or on Dor (vxi)

aioGpibImmediateOrSrq

2

Receive on Immediate or Srq (gpib)

aioDisableBstrConvert

4

Disable conversion of BString to String, can be combined with one of the previous values.

Comments

The hexadecimal format of lDevice parameter is as follows:

lDevice = 0xBBPPSS

Where:

 

BB

Board address (1 - 9)

PP

Device Primary address (0 - 31) - 0 if not used (bus address), 31 used for Primary address of 0

SS

Device Secondary address (0 - 31) - 0 if not used (bus address or device without Secondary address),  31 used for Secondary address of 0      

The value of lDevice may be obtained using the GetDriverAddress function.

The sEOS can be 0-2 bytes long. It specifies the data bytes that signal the end of data.

This function returns the number of bytes received, including the sEOS string. A value of -1 indicates failure.

Example

The following command reads a maximum of 20 bytes from the DMM to sData. The terminator used is Carriage Return/Line Feed. EOI is enabled and timeout is set to 1500 mSec:

lDevice=GetDriverAddress("DMM")

GpibReceive(lDevice, "\r\n", True, 1500, , sData, 20)

See Also

GpibSend