Host Serial Transmit
Configure host-side serial communications interface to transmit data to serial port
Motor Control Blockset / Protection and Diagnostics
The Host Serial Transmit block specifies the configuration of the data that it transmits to the target hardware.
The data package that the block sends is limited to 16 bytes of ASCII characters, including package headers and terminators. Calculate the size of a package by including the package header, or terminator, or both, and the data size. This table shows the number of bytes in each data type.
|Data Type||Byte Count|
For example, if your data package has a package header 'S' (1 byte) and package terminator
'E' (1 byte), that leaves 14 bytes for the actual data. If your data is of type
int8, there is space in the data package for 14
int8s. If your data is of type
uint16, there is
space in the data package for 7
uint16s. If your data is of type
int32, there is space in the data package for only 3
int32s, with 2 bytes left over. Even though you could fit two
int8s or one
uint16 in the remaining space, you
should not, because you cannot mix data types in the same package.
The number of data types that can fit into a data package determine the data size. In the
preceding example, the data size is 14 for
int8 and 7 for
uint16. When the data size exceeds 16 bytes, unexpected behavior,
including run-time errors, are likely to occur.
data — Port to receive data to be transmitted
This port accepts both one-dimensional and matrix data for transmission to the target hardware.
Serial Connection — Serial port used for transmitting data
Serial 1 (default) |
Serial 2 |
Serial 3 |
Specify a serial port to transmit to the target hardware. Select an available serial port from the list. You can configure the selected port using the Host Serial Setup block. If you do not configure a serial port, the block prompts you to do so. Each Host Serial Transmit block must have a configured serial port. If you use multiple ports in your simulation, you must configure each port separately.
Additional package header — Package header data
'S' (default) | scalar
Specifies the data located at the front of the transmitted data package, which is not part of the data being transmitted, and generally indicates start of data. The additional package header must be an ASCII value. You can use a text value or a numeric value in the range (0–255). You must put single quotes around the text that you enter in this field, but the quotes are not transmitted and they are not included in the total byte count.
Additional package terminator — Package terminator data
'E' (default) | scalar
Specifies the data located at the end of the transmitted data package, which is not part of the data being transmitted, and generally indicates end of data. The additional package terminator must be an ASCII value. You can use a text value or a numeric value in the range (0–255). You must put single quotes around text entered in this field, but the quotes are not transmitted and they are not included in the total byte count.
Enable blocking mode — Block simulation while sending data
off (default) |
Select this parameter to block the simulation while transmitting data. Clear this parameter if you do not want the write operation to block the simulation.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Design and simulate fixed-point systems using Fixed-Point Designer™.
Introduced in R2020a