Agilent Technologies E5071C Manual page 1067

Hide thumbs Also See for E5071C:
Table of Contents

Advertisement

E5071C
Dim strSend As String
strSend = command + vbCrLf
count = send(socketId, ByVal strSend, Len(strSend), 0)
If count = SOCKET_ERROR Then
MsgBox ("ERROR: send = " + Str$(count))
SendCommand = COMMAND_ERROR
Exit Function
End If
SendCommand = NO_ERROR
End Function
The procedure corresponding to the Receiving part of communication is
RecvAscii and other functions. RecvAscii receives a message in ASCII
format and stores it in the dataBuf output parameter. Maximum length of
the message is specified with the maxLength input parameter. Each
functional part of RecvAscii is described below.
In (1), a message (a response to a query for a SCPI command) is received
from the E5071C as a series of characters using the recv function of
WinSock API. If an error occurs, the control returns to the main program
with a message. The recv function takes a socket descriptor (input), a
message to be received (input), message length (input) and a flag (input)
as its parameters.
In (2), it is determined whether each received character is LF (ASCII code:
10). When it is LF, receiving is terminated by adding NULL (ASCII code: 0)
to the end of the dataBuf string and the control returns to the main
program.
In (3), the number of the last characters that were read out is added to
the count value for checking the number of received characters, and the
characters are appended to the end of the dataBuf string.
RecvAscii
Function RecvAscii(dataBuf As String, ByVal maxLength As Integer) As Integer
Dim c As String * 1
Dim length As Integer
dataBuf = ""
While length < maxLength
DoEvents
count = recv(socketId, c, 1, 0) '
If count < 1 Then '
1294

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents