| Instrument Control Toolbox | ![]() |
Specify when the EOS character is written or read
Description
For GPIB, VISA-GPIB, VISA-VXI, and VISA-GPIB-VXI objects, you can configure EOSMode to be none, read, write, or read&write.
If EOSMode is none, the End Of String (EOS) character is ignored. If EOSMode is read, the EOS character is used to terminate a read operation. If EOSMode is write, the EOS character is appended to the command being written whenever \n is encountered. If EOSMode is read&write, the EOS character is used in both read and write operations. If the EOS character is written to the instrument then the End Or Identify (EOI) line is asserted.
The EOS character is specified by the EOSCharCode property. The CompareBits property specifies the number of bits that must match the EOS character to complete a read operation, or to assert the EOI line.
Rules for Completing a Read Operation
For any EOSMode value, the read operation completes when:
Additionally, if EOSMode is read or read&write (reading is enabled), then the read operation can complete when the EOSCharCode property value is detected.
Rules for Completing a Write Operation
Regardless of the EOSMode value, a write operation completes when:
Additionally, if EOSMode is write or read&write, the EOI line is asserted each time the EOSCharCode property value is written to the instrument.
Characteristics
| Usage |
GPIB, VISA-GPIB, VISA-VXI, VISA-GPIB-VXI |
| Read only |
Never |
| Data type |
String |
Values
Example
Suppose you input a nominal voltage signal of 2.0 volts into a function generator, and read back the voltage value using fscanf.
g = gpib('ni',0,1);
fopen(g)
fprintf(g,'Volt?')
out = fscanf(g)
out =
+2.00000E+00
To illustrate how you use the EOSMode and EOSCharCode properties, the following commands configure the read operation to end on the E character. To do this, the ASCII code for E is determined with the double function.
double('E')
ans =
69
EOSMode and EOSCharCode are configured to terminate the read operation when ASCII code 69 is encountered.
set(g,'EOSMode','read') set(g,'EOSCharCode',69) fprintf(g,'Volt?') out = fscanf(g) out = +2.00000
Properties
CompareBits, EOIMode, EOSCharCode
| EOSCharCode | ErrorAction | ![]() |