| Target Support Package™ TC2 | ![]() |
Configure host-side serial communications interface to receive data from serial port
c2000scilib in Target Support Package™ TC2 software
![]()
Specify the configuration of data being received from the target by this block.
The data package being received 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.
Acceptable data types are single, int8, uint8, int16, uint16, int32, or uint32. The number of bytes in each data type is listed in the following table:
| 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 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 room in the data package for 14 int8s. If your data is of type uint16, there is room in the data package for 7 uint16s. If your data is of type int32, there is room 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 length (see Data length in the Dialog Box description). In the example just given, the 14 for data type int8 and the 7 for data type uint16 are the data lengths for each data package, respectively. When the data length exceeds 16 bytes, unexpected behavior, including run time errors, may result.

You may configure up to four COM ports (COM1 through COM4) for up to four host-side SCI Receive blocks.
This field specifies the data located at the front of the received data package, which is not part of the data being received, and generally indicates start of data. The additional package header must be an ASCII value. You may use any string or number (0–255). You must put single quotes around strings entered in this field, but the quotes are not received nor are they included in the total byte count.
Note Any additional packager header or terminator must match the additional package header or terminator specified in the target SCI transmit block. |
This field specifies the data located at the end of the received data package, which is not part of the data being received, and generally indicates end of data. The additional package terminator must be an ASCII value. You may use any string or number (0–255). You must put single quotes around strings entered in this field, but the quotes are not received nor are they included in the total byte count.
Choice of single, int8, uint8, int16, uint16, int32, or uint32.
The input port of the SCI Transmit block accepts only one of these values. Which value it accepts is inherited from the data type from the input (the data length is also inherited from the input). Data must consist of only one data type; you cannot mix types.
How many of Data type the block receives (not bytes). Anything more than 1 is a vector. The data length is inherited from the input (the data length input to the SCI Transmit block).
Default value from the Receive block. This value is used, for example, if a connection time-out occurs and the When connection timeout field is set to "Output the last received value", but nothing yet has been received.
Specify what to output if a connection time-out occurs. If "Output the last received value" is selected, the last received value is what is output, unless none has yet been received , in which case the Initial output is considered the last received value.
If "Output customized value" is selected, a field for specifying a custom value is added to the dialog box (as shown in the following figure).

Determines how often the SCI Receive block is called (in seconds). When you set this value to -1, the model inherits the sample time value of the model. To execute this block asynchronously, set Sample Time to -1, and refer to Asynchronous Interrupt Processing for a discussion of block placement and other necessary settings.
When this field is checked, the SCI Receive block adds another output port for the transaction status, and appears as shown in the following figure.

The error status may be one of the following values:
0: No errors
1: A time-out occurred while the block was waiting to receive data
2: There is an error in the received data (checksum error)
3: SCI parity error flag — Occurs when a character is received with a mismatch
4: SCI framing error flag — Occurs when an expected stop bit is not found
![]() | Saturate IQN | SCI Setup | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |