Skip to Main Content Skip to Search
Product Documentation

xPCOpenSerialPort - Open RS-232 connection to xPC Target system

Prototype

int xPCOpenSerialPort(int comPort, int baudRate);

Arguments

comPort

Index of the COM port to be used (0 is COM1, 1 is COM2, and so forth).

baudRate

baudRate must be one of the following values: 1200, 2400, 4800, 9600, 19200, 38400, 57600, or 115200.

Return

The xPCOpenSerialPort function returns the port value for the connection. If the function detects an error, it returns -1.

Description

The xPCOpenSerialPort function initiates an RS-232 connection to an xPC Target system. It returns the port value for the connection. Be sure to pass this value to all the xPC Target API functions that require a port value.

If you enter a value of 0 for baudRate, this function sets the baud rate to the default value (115200).

See Also

API functions xPCOpenTcpIpPort, xPCClosePort, xPCReOpenPort, xPCTargetPing, xPCOpenConnection, xPCCloseConnection, xPCRegisterTarget, xPCDeRegisterTarget

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS