| Instrument Control Toolbox | ![]() |
Write binblock data to the instrument
Syntax
Arguments
Description
binblockwrite(obj,A)
writes the data specified by A to the instrument connected to obj as a binary-block (binblock). The binblock format is defined as #<N><D><A> where
N specifies the number of digits D that follow.
D specifies the number of data bytes A that follow.
A is the data written to the instrument.
For example, if A is given by [0 5 5 0 5 5 0], the binblock would be defined as [double('#') 1 7 0 5 5 0 5 5 0].
binblockwrite(obj,A,' writes binblock data translating MATLAB values to the precision specified by precision')
precision. By default the uchar precision is used. Refer to the fwrite function for a list of supported precisions.
Remarks
Before you can write data to the instrument, it must be connected to obj with the fopen function. A connected instrument object has a Status property value of open. An error is returned if you attempt to perform a write operation while obj is not connected to the instrument.
The ValuesSent property value is increased by the number of values written each time binblockwrite is issued.
An error occurs if the output buffer cannot hold all the data to be written. You can specify the size of the output buffer with the OutputBufferSize property.
Example
Create the GPIB object g associated with a National Instruments GPIB controller with board index 0, and a Tektronix TDS 210 oscilloscope with primary address 2.
Connect g to the instrument, and write string commands that configure the scope to transfer binary waveform data to memory location A.
fopen(g) fprintf(g,'DATA:DESTINATION REFA'); fprintf(g,'DATA:ENCDG SRPbinary'); fprintf(g,'DATA:WIDTH 1'); fprintf(g,'DATA:START 1');
Write the binblock data to the scope.
Functions
binblockread, fopen, fwrite, instrhelp
Properties
OutputBufferSize, OutputEmptyFcn, Status, Timeout, TransferStatus, ValuesSent
| binblockread | clear | ![]() |