Serial Configuration

Configure parameters for serial port

Library

Instrument Control Toolbox

  • Serial Configuration block

Description

The Serial Configuration block configures parameters for a serial port that you can use to send and receive data. You must set the parameters of your serial port before you set up the Serial Receive and the Serial Send block.

You must first specify the configuration of your serial port before you configure the Serial Receive and Serial Send blocks. The Receive and Send blocks will prompt you to add a Configuration block to configure your serial port properties.

Note

You need a license for both the Instrument Control Toolbox™ and Simulink® software to use this block.

Other Supported Features

  • This block supports the use of Simulink Accelerator™ mode, but not Rapid Accelerator or code generation.

  • The block supports the use of model referencing, so that your model can include other Simulink models as modular components.

For more information on these features, see the Simulink documentation.

Parameters

Communication port

Specify the serial port to configure. You have to select an available port from the list. By default no port is selected and this field displays <Please select a port...>. Use this configured port in your Serial Send and Serial Receive blocks. Each Serial Send and Receive block must have a configured serial configuration. If you use multiple serial ports in your simulation, you must configure each port using a separate serial configuration block.

Baud rate

Specify the rate at which bits are transmitted for the serial interface. Default value is 9600.

Data bits

Specify the number of data bits to transmit over the serial interface. Default value is 8 and other available values are 5, 6, and 7.

Parity

Specify how you want to check parity bits in the data bits transmitted via the serial port. By default this is set to none, and the available values are:

  • none — Where no parity checking is done.

  • even — Where parity bit is set to 0 if the number of ones in a given set of bits is even.

  • odd — Where parity bit is set to 1 if the number of ones in a given set of bits is odd.

  • mark — Where parity bit is always set to 1.

  • space — Where parity bit is always set to 0.

Stop bits

Specify the number of bits used to indicate the end of a byte. The number of data bits you select determines the choices available for stop bits. If you select data bits 6, 7, or 8, then the default value is 1 and the other available choice is 2. If you select data bit 5, then the only choice available is 1.5.

Byte order

Specify the byte order as littleEndian (default) or bigEndian. If byte order is littleEndian, then the instrument stores the first byte in the first memory address. If byte order is bigEndian, then the instrument stores the last byte in the first memory address.

You should configure byte order to the appropriate value for your instrument before performing a read or write operation. Refer to your instrument documentation for information about the order in which it stores bytes.

Flow control

Specify the process of managing the rate of data transmission on your serial port. Choose none to have no flow control or hardware to let your hardware determine the flow control.

Timeout

Specify the amount of time that the model will wait for the data during each simulation time step. The default value is 10 (seconds).

Introduced in R2008a