Function
Performs data transmitting.
Format
Ret = GpibSendData ( Id, SendLen, SendBuf)
Parameter
Id [ VB.NET: Short ][ C, C++: short ][ C#: short ]
When using DevID:
In master mode:
Specifies the address of slave device to receive data for listener in GpibSetAddrInfo.
Specifies address of master device for talker.
(Please use this when transmitting data to plural slave devices at the same time)
In slave mode:
It is not necessary to perform GpibSetAddrInfo.
When using EqpID:
Transmits data to address of slave device contained in specified EqpID.
SendLen [ VB.NET: Integer ][ C, C++: long * ][ C#: ref int ]
Sets number of data to transmit and retrieves number of transmitted data.
(For initial state, the number of transmitted data does not include delimiter)
IN |
1 to 2147483647(7FFFFFFFH) |
Number of data to transmit (bytes) |
OUT |
|
Number of transmitted data (bytes) |
SendBuf [ VB.NET: StringBuilder / Byte() ][ C, C++: char * ][ C#: string / byte[] ]
Sets data to transmit.
Return Value
Ret [ VB.NET: Integer ][ C, C++: long ][ C#: int ]
0 |
Normality completion |
10001 |
Invalid ID was specified |
10002 |
Driver can not be called |
10912 |
Pointer to SendLen is NULL |
10913 |
Pointer to SendBuf is NULL |
10921 |
Information of address specification is wrong. (Only when DevID is used) |
10940 |
Asynchronous function is running now |
20923 |
When it was not a master (controller), communication accompanied by address was performed. |
20941 |
Forcible termination for asynchronous function |
20942 |
Terminates by forcible termination key |
20944 |
TimeOut |
20945 |
No connected device (GPIB error) |
Initial Value
None
Remarks
If you want to include delimiter in SendLen, perform setting in GpibSetStatus.
When you want to transmit data containing delimiter only, set no delimiter in GpibSetDelim, transmit delimiter as data.
Example
When using DevID:
Master mode:
Transmits same data (*IDN?) to slave devices whose address are 1 and 2 at the same time, and outputs number of transmitted data on normal completion.
C |
short Talker, ListenerArray[15]; long SendLen; char SendBuf[256]; Talker = 0; ListenerArray[0] = 1; ListenerArray[1] = 2; ListenerArray[2] = -1; Ret = GpibSetAddrInfo ( DevId, Talker, ListenerArray ); strcpy ( SendBuf, "*IDN?" ); SendLen = strlen ( SendBuf ); Ret = GpibSendData ( DevId, &SendLen, SendBuf ); if ( Ret == 0 ) Printf ( "%ld\n", SendLen ); |
Slave mode:
Transmits data to master and outputs number of transmitted data on normal completion.
C |
short Talker, ListenerArray[15]; long SendLen; char SendBuf[256]; Talker = -1; ListenerArray[0] = -1; Ret = GpibSetAddrInfo ( DevId, Talker, ListenerArray ); strcpy ( SendBuf, "*IDN?" ); SendLen = strlen ( SendBuf ); Ret = GpibSendData ( DevId, &SendLen, SendBuf ); if ( Ret == 0 ) Printf ( "%ld\n", SendLen ); |
When using EqpID:
Transmits data to destination device of specified EqpID and outputs number of transmitted data on normal completion.
C |
long SendLen; char SendBuf[256]; strcpy ( SendBuf, "*IDN?" ); SendLen = strlen ( SendBuf ); Ret = GpibSendData ( EqpId, &SendLen, SendBuf ); if ( Ret == 0 ) Printf ( "%ld\n", SendLen ); |
See Also
GpibRecData | GpibSetDelim | GpibSetTimeOut | GpibSetAddrInfo | GpibSetEscape