Sends data bytes to a specified GPIB device.
[ lBytesSent = ] GpibSend ( lDevice , sEOS , bEOI , lTimeoutmSec [, enMode] , pSrc [, lBytes ] )
The GpibSend procedure syntax has the following parts:
Name |
Type |
Description |
lBytesSent |
Long |
Bytes actually sent |
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 |
Output send mode. Only the default value is 0 (aioDefault) which can be combined with aioDisableBstrConvert. |
pSrc |
Val Any |
Source data buffer |
lBytes |
Val Long |
Maximum number of data bytes to send. When the default value (-1) is used the size of the send buffer pSrc is used. |
bEOI can have one of the following values:
Value |
Description |
True * |
Assert the EOI line (End or Identify) on the last byte sent. |
False |
Assertion is not required. |
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. |
The hexadecimal format of the 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 devise 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. This string is sent after the pSrc is sent.
If lBytes was not specified(-1), then it will be set to the length of the source data buffer, pSrc.
This function returns the number of bytes sent, including the sEOS string. A value of -1 indicates failure.
The following command sends the string "F1G2\r\n" to the DMM. The terminator used is Carriage Return/Line Feed, EOI is enabled, and timeout is set to 150 mSec:
lDevice=GetDriverAddress("DMM")
if GpibSend(lDevice, "\r\n", True, 150, ,"F1G2")<>6
abort
endif