Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

RS485_422_INIT Page 1 of 3

RS485_422_INIT
The RS485_422_INIT function block is used to parameterize the local serial RS485/422 interface of the
controller. The initialization parameters for the interface are specified in the data structure that is applied
at the PARAMETER input of the function block (see the description of the data structure ). Successful
parameterization is indicated at the VALID output.

Following successful parameterization, you can use the RS485_422_RECEIVE function block to receive
data from the receive buffer of the serial interface and the RS485_422_SEND function block to send data
via the interface.

The function block must not be instantiated more than once.

Parameterization of the function block

Input and output parameters of the function block:

Parameter Data type Description

Input parameters

ENABLE BOOL A rising edge at the ENABLE input executes the function block. The
local serial RS485/422 interface is parameterized with the values
set at the PARAMETER input.

COM INT Selection of the COM port.

PARAMETER T_RS485_422 Initialization parameters for the local serial RS485/422 interface
(see the description of the T_RS485_422 data structure below this
table).

Output parameters

VALID BOOL Indicates the function block status.


TRUE: Parameterization successfully completed.
FALSE: An error occurred during parameterization. The ERROR
output is set to TRUE and the corresponding error code is output at
the STATUS output.

ERROR BOOL Indicates whether an error occurred when executing the function
block.
TRUE: Error occurred. The corresponding error code is output at
the STATUS output.
FALSE: No error occurred.

mk:@MSITStore:C:\Program%20Files%20(x86)\PHOENIX%20CONTACT\Softwar... 22.06.2023
RS485_422_INIT Page 2 of 3

STATUS WORD This output provides the error code in the event of an error (see
List of error codes ). Only valid for ERROR = TRUE.

Elements of the T_RS485_422 data structure

The T_RS485_422 data structure at the PARAMETER input contains the following elements:

TYPE T_RS485_422 :

STRUCT

protocol :INT; (* 0: transparent, data transmission without


protocol , full duplex (default)
2: transparent, data transmission without protocol ,
half duplex *)

baudrate :INT; (* 3: 1200kBit; 5: 2400kBit; 6: 4800kBit; 7:


9600kBit; 8: 19200kBit; 9: 38400kBit; 10: 57600kBit;
11: 115200kBit *)

databits :INT; (* 3: 8/N; 4:8/E (default); 5: 8/O *)

stopbits :INT; (* 1: 1 stop bit (default); 2: 2 stop bits *)

flowcontrol :INT; (* not supported *)

error_pattern :INT; (* not supported *)

first_delimiter :INT; (* not supported *)

second_delimiter :INT; (* not supported *)

XON_pattern :INT; (* not supported *)

XOFF_pattern :INT; (* not supported *)

END_STRUCT;

END_TYPE

Error codes at the STATUS output

Only valid for ERROR = TRUE.

STATUS Meaning

0x0101 Invalid data type connected to PARAMETER input.

0x0102 Data type information not available.

0x0103 Data type does not match the specification of T_RS485_422.

0x0104 Data types of the T_RS485_422 elements cannot be determined.

mk:@MSITStore:C:\Program%20Files%20(x86)\PHOENIX%20CONTACT\Softwar... 22.06.2023
RS485_422_INIT Page 3 of 3

0x0105 Unallowed multiple instantiation.

0x0108 COM port not available.

0x0160 Unknown protocol.

0x0161 Unknown baud rate.

0x0162 Unknown number of data bits.

0x0163 Unknown number of stop bits.

0x0164 Unknown flow control.

0x0200 Invalid elements in data type T_RS485_422.

mk:@MSITStore:C:\Program%20Files%20(x86)\PHOENIX%20CONTACT\Softwar... 22.06.2023

You might also like