Serial Receive
Receive an [Nx1] array of data on the serial port and write it to the data block output. When data is not available, write 0 to the data block output
Add-On Required: This feature requires the Simulink Support Package for Android Devices add-on.
Libraries:
Simulink Support Package for Android Devices /
Communication
Description
Get an [Nx1] array of data on the specified serial port and write to the Data block output.
The Serial Receive block has two outputs, Data and Status.
When data is available:
The Data block output emits data from the serial receive buffer.
The Status block output emits
1
.
When data is not available:
The Data block output emits
0
.The Status block output emits
0
.
The Data block outputs the datatypes, int8, uint8, int16, uint16, int32, uint32, double, single, or boolean based on the selected Data type parameter value on the block. The default data type is int32.
The Status block output emits int values. You can use the Status
block output to determine whether a value of 0
emitted by the
Data port is data, or an indication that no data was
received.
During simulation this block outputs 0
.
Note
Only one Serial Transmit and one Serial Receive blocks are allowed in a model.
Parameters
Version History
Introduced in R2019b