Contents

ReadAsyncMode

Specify whether an asynchronous read operation is continuous or manual

Description

You can configure ReadAsyncMode to be continuous or manual. If ReadAsyncMode is continuous, the serial port object continuously queries the device to determine if data is available to be read. If data is available, it is automatically read and stored in the input buffer. If issued, the readasync function is ignored.

If ReadAsyncMode is manual, the object does not query the device to determine if data is available to be read. Instead, you must manually issue the readasync function to perform an asynchronous read operation. Because readasync checks for the terminator, this function can be slow. To increase speed, configure ReadAsyncMode to continuous.

    Note:   If the device is ready to transmit data, it will do so regardless of the ReadAsyncMode value. Therefore, if ReadAsyncMode is manual and a read operation is not in progress, data might be lost. To guarantee that all transmitted data is stored in the input buffer, you should configure ReadAsyncMode to continuous.

To determine the amount of data available in the input buffer, use the BytesAvailable property. For either ReadAsyncMode value, you can bring data into the MATLAB® workspace with one of the synchronous read functions such as fscanf, fgetl, fgets, or fread.

Characteristics

Read only

Never

Data type

String

Values

{continuous}

Continuously query the device to determine if data is available to be read.

manual

Manually read data from the device using the readasync function.

Was this topic helpful?