EasyManua.ls Logo

ALTUS Nexto NX3004 - Page 204

ALTUS Nexto NX3004
388 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
4. Configuration
196
Utilization example in ST language, after the library Nexto Serial is inserted in the project:
PROGRAM MainPrg
VAR
Config: SERIAL_CFG;
Port: SERIAL_PORT := COM1;
Parameters: SERIAL_PARAMETERS := (BAUDRATE := BAUD9600,
DATABITS := DATABITS_8,
STOPBITS := STOPBITS_1,
PARITY := PARITY_NONE,
HANDSHAKE := RS232_RTS,
UART_RX_THRESHOLD := 8,
MODE :=NORMAL_MODE,
ENABLE_RX_ON_TX := FALSE,
ENABLE_DCD_EVENT := FALSE,
ENABLE_CTS_EVENT := FALSE);
Status: SERIAL_STATUS;
END_VAR
//INPUTS:
Config.REQUEST := TRUE;
Config.PORT := Port;
Config.PARAMETERS := Parameters;
//FUNCTION:
Config();
//OUTPUTS:
Config.DONE;
Config.EXEC;
Config.ERROR;
Status := Config.STATUS; // If it’s necessary to treat the error
SERIAL_GET_CFG
The function block is used to capture the desired serial port configuration.
Figure 4-94. Block to Capture the Serial Configuration
Input parameters
Type
Description
REQUEST
BOOL
This variable, when true, enables the function block use.
PORT
SERIAL_PORT
Select the serial port, as described in the SERIAL_PORT data type.
Table 4-131. SERIAL_GET_CFG Input Parameters

Table of Contents