VectorStar™ MS4640A SeriesMicrowave Vector Network Analyzer : Programming the VectorStar Series VNAs : Data Transmission Methods
 
Data Transmission Methods
Data transmissions to and from the MS4640A conform to the protocols specified by the IEEE 488.2 GPIB Standard. The 488.2 Standard specifies how any data, such as ASCII numbers, strings, or blocks of data bytes, will be transmitted over the GPIB. This section describes the various transmission methods in use by the MS4640A. The transmission method names described below (also called notations) will be used throughout the Programming Manual when describing specific MS4640A data transfer commands. Data transmission notations are easily distinguished in text as they are always shown surrounded by the “less than” and the “greater than” characters (< >). The transmission type notations used in describing various MS4640A VNA data transmissions are:
For ASCII numbers, the notations are: <NR1>, <NR2>, <NR3>, or <NRf>
For ASCII strings (printable characters and print formatting codes), the notation is: <string>
For generic (7-bit) ASCII characters, the notation is: <Arbitrary ASCII>
For generic binary bytes, (7-bit ASCII or binary), the notation is: <block>
<NR1>
This notation represents ASCII integer values. A comma (,) is used to separate multiple values sent in a single command's input or output string. Examples of values that can be represented by <NR1> notation:
10
-29,179
<NR2>
This notation represents ASCII floating point values in decimal point format. A comma (,) is used to separate multiple values sent in a single command's input or output string. Examples of values that can be represented by <NR2> notation:
1.0
-0.00015
12.743,-180.07
<NR3>
This notation represents ASCII floating point values in exponential format (scientific notation). A comma (,) is used to separate multiple values sent in a single command's input or output string. Examples of values that can be represented by <NR3> notation:
1.0E9
-7.056E3
9.0E-2,3.42E2
<NRf>
This notation is used to signify that data can be in either <NR1>, <NR2>, or <NR3> format as described above. Examples of values that can be represented by <NRf> notation:
1.0E-9
10.005
-83,4.5E2,-234.9901
<string>
This notation represents a string of ASCII characters (including non-printable characters) that is delimited (surrounded) with either single quotes (' ') or double quotes (" "). The string can include text formatting characters such as line feed, space, carriage return, or printer control characters. Note that if a double quote character must be sent as part of the string, then it must be followed by an additional double quote. Alternatively, the string can be sent using single quotes (See "cal_file" example below). Examples of data represented by <string> notation:
"1/15/98"
"Save ""cal_file"" now"
'Save "cal_file" now'
<ASCII> or <Arbitrary ASCII>
This notation represents undelimited 7-bit ASCII text. The end of the text must be terminated with the 0A character (decimal 10) and concurrent setting (^) of the GPIB End of Transmission State (EOI). This requirement makes it necessary for <Arbitrary ASCII> text to be transmitted only at the end of a program or response message, i.e., at the end of a multiple input or output statement. Example of data represented by <Arbitrary ASCII> notation:
ANRITSU,MS4642A,123456,1.0<0A^EOI>
The example shows a sample response from the *IDN?, 488.2 common query. In the example, the instrument identifies itself as an ANRITSU MS4642A, with serial number 123456, and software version 1.0 installed.
Note 
Note that decimal 10 (0A character) must be sent with the EOI to signal the end of transmission.
<block> or <arbitrary block>
This notation represents data that is transmitted as 8-bit data bytes (00–FF hex, 0–255 decimal, notation is <DAB>). This is useful for transmitting large blocks of:
Formatted ASCII data
Formatted XML data
Formatted binary data
Unformatted binary data
The data stream is immediately preceded by a variable length ASCII header that is encoded with the number of data bytes to be sent. The header always starts with the pound (#) character. The header and the transmitted data messages are described as follows:
#nm1..mn<DAB1>...<DABm>
Where:
# = The pound sign character. Required for binary data transfer.
n = Number of digits to follow (m1..mn) that make up the number m.
m1..mn = Taken together, this makes up the number m which is the number of data bytes to follow that constitute the requested data.
<DAB> = An 8 bit binary data byte. This is the data (or information) being sent.
Note 
If n = 0, then m is omitted, and transmission end is signaled by sending the line feed character (0A, or decimal 10) and concurrent setting (^) of the GPIB End Of Transmission State (EOI) immediately following the last <DAB>.
Example 1: #3204<DAB1>...<DAB204>
Example 1 shows how 204 8-bit bytes are transmitted using the proper header. The header in this example is comprised of 5 characters (#3204). It begins with the pound character (#). The next character (3) indicates there are 3 digits to follow that indicate the number of bytes being transmitted (204). The next three characters (204) indicate the number of data bytes being transmitted immediately after the header. Next comes the actual data bytes, or information, being transmitted (<DAB1>...<DAB204>).
Example 2: #512808<DAB1>...<DAB12808>
Example 2 shows how 12808 bytes are transmitted using the proper header. The header in this example is comprised of 7 characters (#512808). It begins with the pound character (#). The next character (5) indicates there are 5 digits to follow that indicate the number of bytes being transmitted (12808). The next five characters (12808) indicate the number of data bytes being transmitted immediately after the header. Next comes the actual data bytes, or information, being transmitted (<DAB1>...<DAB12808>).
Note 
Examples 1 and 2 above demonstrate the <block> form referred to as <Definite Length Arbitrary Block>. It is so called because the number of data bytes being transmitted is known from the encoded header.
Example 3: #0<DAB1>...<DABm><0A^EOI>
Example 3 shows how an unknown number of bytes are transmitted using the proper header. The header in this example is comprised of 2 characters (#0). As usual, the header begins with the pound character (#). The next character (0) indicates there is an unknown number of data bytes being transmitted immediately after the header. Next comes the actual data bytes being transmitted (<DAB1>...<DABm>). The end of the data stream is signaled by sending the line feed character (0A, or decimal 10) and concurrent setting (^) of the GPIB End of Transmission State (EOI).
Note 
Example 3, above, demonstrates a special form of <block> data referred to as the <Indefinite Length Arbitrary Block>. It is so called because the number of data bytes being transmitted is unknown, and therefore cannot be encoded in the header. Instead, the header always consists of the pound and zero characters (#0) and end of the data stream is always signaled by sending the line feed character (0A, or decimal 10) and concurrent setting (^) of the GPIB End of Transmission State (EOI). This requirement makes it necessary for <Indefinite Length Arbitrary Block> text to be transmitted only at the end of a program or response message (at the end of a multiple input or output statement).
<char>
Character program data such as CW, FIXed, UP, and DOWN. A single instance in a command or query is <char>. If multiple instances are required, each is identified such as <char1> or <char2> and the individual elements are separated by commas:
<char1>,<char2>
<char1>,<char2>,<char3>
<char1>,<char2>,<char3>,<char4>
MPND
The instrument numeric limit as the Maximum Positive/Negative Double Precision Number or:
+/– 1.792 639 134 86 E+308
MPNF
The instrument numeric limit as the Maximum Positive/Negative Float Number or:
+/- 3.402 819 E+38
MPNI
The instrument numeric limit as the Maximum Positive/Negative Integer or:
- 2 147 483 648 to +2 147 483 647
Formatting Data Output
Three commands are provided to alter the way the arbitrary block header for output data is formed.
FDH0
Specifies that the length of the arbitrary block header will be minimized; that is, the byte count section will not contain leading zeros, thus its length is indeterminate. This means that a program must decode the header in order to skip over it. FDH0 is the default mode when the programming language is selected as Lightning (see Configuring the Remote Language).
FDH1
Specifies that the length of the arbitrary block header will be fixed at 11 characters. This is accomplished by forcing leading zeros as required in the byte count section. This means that a program can skip over the arbitrary block header by skipping 11 characters. FDH1 is the default mode when the programming language is selected as Native (see Configuring the Remote Language).
FDH2
Specifies that no arbitrary block header will be sent with the next transmission. This mode is not in compliance with IEEE 488.2 specifications and will persist for all subsequent program messages.
FDHX?
FDH mode query yields the following results:
0: FDH0
1: FDH1
2: FDH2
 
ASCII or Binary Data Format
The following sections discuss the various data output formats:
Non-Array Data
The formats used for data transfers not involving numerical data arrays are preset. They always occur in either binary format or ASCII format, depending on the data. These data transfers include a variety of information. Examples include:
Instrument setup strings
Marker data, queries
Disk directory listings
Numerical Data Arrays
Numerical data array transfers are used to transfer the following types of data:
Measurement data
Calibration data
Sweep frequency, time, or distance values
Each of these data transfer types are individually explained below. You can select either binary or ASCII format for data transfers involving numerical data arrays. The commands described below select and keep the format for all subsequent data transfers.
ASCII Format - FMA
ASCII formatted values represented in <NR1>, <NR2>, <NR3>, or <NRf> formats. The MS4640A VNA accepts any of the above formats as input. It will always output values using <NR3> exponential format with each value represented using 18 characters plus a comma to separate multiple values.
Binary Formats
FMB
Each eight consecutive data bytes represent one floating point value in IEEE 754 64-bit format (double precision, 8 byte, floating point value).
FMC
Each four consecutive data bytes represent one floating point value in IEEE 754 32-bit format (single precision, 4 byte, floating point value).
FMX?
FMA, FMB, FMC format selection query
Byte Ordering
MSB
Byte ordering is most significant byte first. For use only with FMB and FMC. This is the optional byte mode for the MS4640A.
LSB
Byte ordering is least significant byte first. For use with FMB and FMC. This is required for transferring data to/from Intel/IBM based computers. LSB is the default mode.
XSB?
MSB, LSB format selection query.
FMT0
Turn ASCII enhancement off (normal default mode).
FMT1
Turn ASCII enhancement on.
FMTX?
ASCII enhancement ON/OFF status query.
The following SCPI commands select either ASCII or Binary format as described above:
:FORMat:DATA <char>
Where the <char> arguments of ASC or ASCII ::= FMA, REAL ::= FMB, REAL32 ::= FMC
:FORMat:DATA? is the ASC or ASCII, REAL, or REAL32 format selection query.
:FORMat:BORDer <char>
Where the <char> arguments of NORMAL ::= MSB, SWAPPED ::= LSB
:FORMat:BORDer? is the MSB | LSB format selection query.
Enhanced ASCII Formatting
Enhanced ASCII formatting can be applied to both non-array ASCII data and numerical data arrays in the FMA format when this data is output within an <block> format. The format selectively replaces comma data element separators with a line feeds (ASCII 10) in order to enhance the visual effect. The following provides two examples of this enhanced structure:
An unenhanced directory listing
#9000000392Directory of C:\ 1-30-96 13:03,UTIL <DIR> 1-25-96 12:58,PLOT
BMB 38462 1-22-96 14:41,PLOT BMC 307446 1-22-96 14:41,TTT CAL
44174 1-22-96 17:02,TTT2 CAL 44174 1-22-96 17:16,PLOT1 DAT
10323 1-22-96 14:03,PLOT1 HGL 19899 1-22-96 14:02,PLOT2 HGL
38462 1-25-96 13:16,8 Files 502940 Bytes
An enhanced directory listing
#9000000392
Directory of C:\ 1-30-96 13:03
UTIL <DIR> 1-25-96 12:58
PLOT BMB 38462 1-22-96 14:41
PLOT BMC 307446 1-22-96 14:41
TTT CAL 44174 1-22-96 17:02
TTT2 CAL 44174 1-22-96 17:16
PLOT1 DAT 10323 1-22-96 14:03
PLOT1 HGL 19899 1-22-96 14:02
PLOT2 HGL 38462 1-25-96 13:16
8 Files 502940 Bytes
An unenhanced response to OCD
#9000000189-9.99750733376E-01, 3.21409821510E-01, 3.60706359148E-01,
9.82860028744E-01, 7.76742696762E-01,-5.06587028503E-01,-5.07535457611E-01,
-8.45697641373E-01,-6.10321164131E-01,6.05827927589E-01
An enhanced response to OCD
#9000000189
-9.99750733376E-01, 3.21409821510E-01
3.60706359148E-01, 9.82860028744E-01
7.76742696762E-01,-5.06587028503E-01
-5.07535457611E-01,-8.45697641373E-01
-6.10321164131E-01, 6.05827927589E-01