External Interfaces/API    
BytesAvailableAction

Specify the M-file action function to execute when a specified number of bytes are available in the input buffer, or a terminator is read

Description

You configure BytesAvailableAction to execute an M-file action function when a bytes-available event occurs. A bytes-available event occurs when the number of bytes specified by the BytesAvailableActionCount property is available in the input buffer, or after a terminator is read, as determined by the the BytesAvailableActionMode property.

If the RecordStatus property value is on, and a bytes-available event occurs, the record file records this information:

Refer to Creating and Executing Action Functions to learn how to create an action function.

Characteristics

Read only
Never
Data type
Action function

Values

The default value is an empty string.

Example

Create the serial port object s for a Tektronix TDS 210 two-channel oscilloscope connected to the serial port COM1.

Configure s to execute the M-file action function instraction when 40 bytes are available in the input buffer.

Connect s to the oscilloscope.

Write the *IDN? command, which instructs the scope to return identification information. Since the default value for the ReadAsyncMode property is continuous, data is read as soon as it is available from the instrument.

The resulting output from instraction is shown below.

56 bytes are read and instraction is called once. The resulting display is shown above.

Suppose you remove 25 bytes from the input buffer and then issue the MEASUREMENT? command, which instructs the scope to return its measurement settings.

The resulting output from instraction is shown below.

There are now 102 bytes in the input buffer, 31 of which are left over from the *IDN? command. instraction is called twice; once when 40 bytes are available and once when 80 bytes are available.

See Also

Functions

record

Properties

BytesAvailableActionCount, BytesAvailableActionMode, RecordStatus, Terminator, TransferStatus


 BytesAvailable BytesAvailableActionCount