Seriell_Set data structure
The RS232-specific function blocks enable specific serial parameters to be set in the default configuration of the BC8150. It is therefore possible to set the length of the I/O data, the baud rate, and the transfer mode from the local PLC project. The function block is not required for the TwinCAT configuration, as in this case the settings are created via the System Manager.
BC8150 library (old version)
(download)
BC8150 library (current version)
(download)
example for BC8150 and KS8000 protocol
(download)
example for BC8150 and ModbusRTU protocol
(download)
BC8150_Settings

FUNCTION_BLOCK BC8150_Settings
VAR_INPUT
bWriteSet :BOOL;
bReadSet :BOOL;
strBC8150_Set :Seriell_Set;
Key
bWriteSet: Rising edge starts the block and reads/writes the parameters. If these have changed, the new parameters are written and the flag bReboot_Necessary is set. The Bus Coupler must then be restarted. The user is notified if/when the bReboot_Necessary flag is set.
bReadSet: Positive edge reads the set RS232 parameters.
strBC8150_Set : Data structure for the RS232 interface.
VAR_OUTPUT
bBusy :BOOL;
bError :BOOL;
iErrorId :WORD;
strBC8150 :Seriell_Setting;
bReboot_Necessary :BOOL;
Key
bBusy: The block is active as long it is TRUE.
bError: Error bit.
iErrorId: Error number.
strBC8150: Output of type, firmware, and RS232 parameters.
bReboot_Necessary: If this bit is TRUE after the bBusy is set to FALSE, then the BC8150 must be restarted so that the RS232 settings are saved.
Seriell_Set data structure
The settings for the RS232 interfaces are transferred with the following data structure.
TYPE ST_COMConfig:
STRUCT
iInputData :INT; (* BC8150: 1..255 *)
iOutputData :INT; (* BC8150: 1..255 *)
Modbus_Mode_BC8150 :E_BC8150_Mode; (* _8data_no_parity, _8data_with_parity, _8data_even_parity, _8data_odd_parity *)
iWatchdog :INT; (* 1000 ms Watchdog für die Modbus und KS8000 Kommunikation , 0 ms Watchdog disabled*)
Modbus_Baudrate :ENUM;(* _1k2Baud, _2k4Baud, _4k8Baud, _9k6kBaud, _19k2Baud, _38k4Baud *)
END_STRUCT
END_TYPE
Key
iInputData: Number of input data (from the point of view of the BC). Size in words for the KS8000 protocol (address 1-39)
iOutputData: Number of output data (from the point of view of the BX). Size in words for the KS8000 protocol (address 1-39)
Modbus_Mode_BC8150: RS232 settings for the ModbusRTU protocol (address 40-59)
iWatchdog: Watchdog for KS8000 and Modbus protocol
Modbus_Baudrate: Baud rate for the ModbusRTU protocol (address 40-59)
iErrorId
Return parameter iErrorId | Meaning |
---|---|
0 | no Error |
-1 | Wrong BC Typ |
-2 | Wrong firmware version |
0x1000_xxxx | xxxx ADS Error Code (see ADS Return Code) |