xPC Target | ![]() ![]() |
The Block Parameters dialog box for the RS-232 Setup block contains the following fields.
Parameter |
Description |
Port |
From the list, select |
Baudrate |
From the list, select |
Number of Databits |
|
Number of Stopbits |
|
Parity |
From the list, select None , Odd , or Even . |
Protocol |
From the list, select |
Send Buffer Size |
|
Receive Buffer Size |
Enter the size, in bytes, of the receive buffer. The Send Buffer Size and Receive Buffer Size must be large enough to hold the data to be sent or received during each model step. It is important to be aware that the buffers must be large enough to also store old data from a prior model step in the event that the entire data transmission was not completed during the prior step. |
Initialization Structure |
Enter the name of the structure containing the initialization messages and the expected acknowledgements when the model is initialized. If you are not using initialization messages, enter an empty matrix in this box. For information on creating this structure, see Creating RS-232 Message Structures (Synchronous) and Creating RS-232 Message Structures (Asynchronous) |
Termination Structure |
Enter the name of the structure containing the termination messages and expected acknowledgements when the model is terminated. If you are not using termination messages, enter an empty matrix in this box. |
The RS232 Setup block defines the number of databits
, baudrate
, protocol
, and so on, for each COM port used in your Simulink model. Each model that uses RS232 I/O must have one RS232 Setup block for each COM port in the model. The RS232 Setup block does not have any inputs or outputs.
If your host PC and target PC are connected using serial communication, one COM port on your target PC is dedicated for communication with your host PC. You cannot use this COM port in your block diagram as an I/O device. For example, if the target PC uses COM1 for the communication with the host PC, COM1 cannot be used by your block diagram. An error message displays if you use COM1 as an I/O device in your block diagram. The error message appears when you attempt to build and download the target application. In this example, it would be necessary for you to use COM2 as an I/O device in your block diagram. If you are using TCP/IP as your host PC to target PC communications protocol, then you can use any COM ports with RS232 I/O drivers in your block diagram.
![]() | RS-232 Simulink Block Reference | RS-232 Send/Receive Block (Synchronous) | ![]() |