Configure host-side serial communications interface to receive data from serial port
Motor Control Blockset / Protection and Diagnostics
The Host Serial Receive block specifies the configuration of the data that it receives from the target hardware.
The data package that the block receives 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. The following table shows the number of bytes in each data type.
Data Type | Byte Count |
---|---|
single | 4 bytes |
int8 and uint8 | 1 byte |
int16 and uint16 | 2 bytes |
int32 anduint32 | 4 bytes |
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 may 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, data size is 14 for int8 and 7 for uint16. When the data size exceeds 16 bytes, unexpected behavior, including run-time errors may occur.