You are here: Core Reference > Coding > Logic > OPEN_PORT

OPEN_PORT

Function Name

OPEN_PORT

Description

Opens a serial port. When a port is open, data can be written to it by using the WRITE_FILE function (see WRITE_FILE).

Arguments

SPEC {STRING}

A string input that is a serial port specification, for example 'COM1,9600,8,N,1,NONE'.

For more information on the data types for the inputs and outputs, see Data Type Hierarchy.

Returns

FileID {UDINT}

Returns the FileID of the file that is to be used when the port is writing or closing.

Example:

ST Program - OPEN_PORT:

To use an OPEN_PORT function in an ST program, you need to use this syntax:

  • PORT := OPEN_PORT( 'COM1,9600,8,N,1,NONE' );

Where PORT is a variable declared earlier in the ST program.


ClearSCADA 2015 R2