### PLCHandler INI Content Example (Parameter) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_symbolic.html When extending PLCHandler configuration, you can add generic parameters. This example sets a parameter named 'EncryptCommunication' to value '1'. ```ini parameter0=EncryptCommunication value0=1 ``` -------------------------------- ### PLCHandler INI Content Example (Logging) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_symbolic.html When extending PLCHandler configuration, you can specify logging filters. This example sets the log filter to 0xFF. ```ini logfilter=16#000000FF ``` -------------------------------- ### Visualization User Management Username Example Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_symbolic.html For controllers with visualization user management, specify the username for login. ```text max.smith ``` -------------------------------- ### PLCHandler Full Configuration Example Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_symbolic.html This INI content completely configures the PLCHandler, overriding gateway settings. It specifies connection details like interface type, IP address, port, and other communication parameters. ```ini [PLC:PLC_IdArti] interfacetype=ARTI active=1 logevents=1 motorola=0 nologin=0 timeout=10000 precheckidentity=0 tries=3 waittime=12 reconnecttime=10 buffersize=0 device=Tcp/Ip (Level 2 Route) instance=PLCWinNT_TCPIP_L2Route parameters=4 parameter0=Address value0=localhost parameter1=Port value1=1200 parameter2=TargetId value2=0 parameter3=Motorola byteorder value3=No ``` -------------------------------- ### CODESYS ApplicationV3 Status Bar Example Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_f_obj_data_source.html Displays the data source type, location of the remote project, and instance name for CODESYS ApplicationV3 communication. ```text CODESYS ApplicationV3 (D:\Projects\Project\_A): Project_A.App_A ``` -------------------------------- ### Dynamic Configuration Variable Example Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_symbolic.html When using 'Dynamic from variable' for connection settings, the IEC variable must be of type DatasourceSym.ConnectionSetup. Set xDataValid to FALSE initially, then to TRUE after specifying address data. ```text POU.dssCommVar ``` -------------------------------- ### Automatic Data Type Creation Example Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_comm_edit_mapping_type.html Demonstrates the 'Create new' mapping type where a unique data type is automatically created for each variable, even if they share the same remote type. This can lead to non-ideal mapping if not managed. ```text The data was read from an OPC UA Server: `station1`, `station2` Standard mapping: A special data type is automatically created for each variable which is read, even though `pumpA`, `pumpB`, and `pumpC` have the same type on the remote data source. This means that a separate data type is created for each mapping. Also for compatible data types. This is probably not what is wanted. In this example, the type mapping is not ideal. ``` -------------------------------- ### Symbol Attribute Usage Example Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_pragma_attribute_symbol.html This example demonstrates how to use the 'symbol' attribute to export variables with different access permissions. Variables A and B are exported with read/write access, C with no access, and D with read access. ```iecst {attribute 'symbol' := 'readwrite'} PROGRAM PLC_PRG VAR A : INT; B : INT; {attribute 'symbol' := 'none'} C : INT; {attribute 'symbol' := 'read'} D : INT; END_VAR ``` -------------------------------- ### Gateway Port Example Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_symbolic.html For CODESYS V3 connections via a gateway, specify the gateway's port number. ```text 1217 ``` -------------------------------- ### Gateway IP Address Example Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_symbolic.html For CODESYS V3 connections via a gateway, specify the gateway's IP address. ```text localhost ``` -------------------------------- ### Accessing Property via Call Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_f_datasourcesmanager.html Example of accessing a property of a program or GVL that is marked for monitoring via a call. ```IEC 61131-3 PLC_PRG.PropertyCall ``` -------------------------------- ### CODESYS Symbolic Status Bar Example Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_f_obj_data_source.html Displays the data source type, connection type, and network name for CODESYS Symbolic communication. ```text CODESYS Symbolic (CODESYS V3): PLC_Name ``` -------------------------------- ### Accessing POU Instance Property via Call Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_f_datasourcesmanager.html Example of accessing a property of a POU instance that is marked for monitoring via a call. ```IEC 61131-3 PLC_PRG.instance.PropertyCall ``` -------------------------------- ### Overwriting Local Types for Visualization Compatibility Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_comm_edit_mapping_type.html Shows how to overwrite automatically created local types to match specific remote types, which is necessary when visualizations depend on predefined data types. The example highlights the attributes used for signature overloading. ```text {attribute 'signatureoverload' := 'Station_I_Must_Use'} {attribute 'signatureoverload' := 'Pump_I_Must_Use'} ``` -------------------------------- ### Accessing Bit-Mapped Variable Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_f_datasourcesmanager.html Example of accessing a variable that is mapped to specific bit addresses within the PLC program. ```IEC 61131-3 x AT %MX0.5 : BOOL; ``` -------------------------------- ### Accessing Structured Variable Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_f_datasourcesmanager.html Example of accessing a nested structured variable, showing access to inner instance members. ```IEC 61131-3 PLC_PRG.outerInst.innerInst.dwVar ``` -------------------------------- ### Accessing Array with Literal Index Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_f_datasourcesmanager.html Examples of accessing elements within an array using a literal index, for both global arrays and arrays within instances. ```IEC 61131-3 PLC_PRG.arrOfInts[3] ``` ```IEC 61131-3 PLC_PRG.inst.arrOfBool[1] ``` -------------------------------- ### Configure and Validate Connection Settings Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_comm_use_dynamic_opc_ua_server_comm_settings.html Set connection parameters like PublishingInterval and SamplingInterval, then set xValid to TRUE to establish the connection. Changes are applied on the next connection establishment. ```IEC 61131-3 config.SubscriptionPublishingInterval := config.SamplingInterval := TIME#2S; config.xValid := TRUE; ``` -------------------------------- ### Sample OPC UA Server Configuration Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_comm_opcua_server_config.html This snippet shows a basic configuration for the OPC UA Server component in the CODESYSControl.cfg file, specifying the network adapter to be used. ```ini [CmpOPCUAServer] NetworkAdapter="eth0" ``` -------------------------------- ### Symbol File Entry for Function Block (Optimized Layout, 64-bit) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_symbolconfiguration.html Illustrates the symbol file entry for a function block with the optimized layout on a 64-bit system. Note the smaller size compared to the compatibility layout. ```xml ``` -------------------------------- ### Accessing Scalar Variable Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_f_datasourcesmanager.html Example of accessing a scalar variable directly from the PLC program. ```IEC 61131-3 PLC_PRG.hugo ``` -------------------------------- ### Symbol File Entry for Function Block (Compatibility Layout, 64-bit) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_symbolconfiguration.html Shows the symbol file entry for a function block using the compatibility layout on a 64-bit system. Implicit variables can lead to varying memory gaps. ```xml ``` -------------------------------- ### Accessing Bit Variable in Function Block Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_f_datasourcesmanager.html Example of accessing a 'BIT' type variable within a function block instance. ```IEC 61131-3 x, y : BIT ``` ```IEC 61131-3 PLC_PRG.dutInst.y ``` -------------------------------- ### Symbol File Entry for Function Block (Optimized Layout, 32-bit) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_symbolconfiguration.html Displays the symbol file entry for a function block with the optimized layout on a 32-bit system. This typically results in the smallest size. ```xml ``` -------------------------------- ### Symbol File Entry for Large Structure (Optimized Layout) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_symbolconfiguration.html Illustrates the symbol file entry for the same large structure but with the optimized memory layout option. Observe the reduced size and adjusted byte offsets. ```xml ``` -------------------------------- ### Symbol File Entry for Function Block (Compatibility Layout, 32-bit) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_symbolconfiguration.html Shows the symbol file entry for a function block using the compatibility layout on a 32-bit system. The size and offsets differ from 64-bit systems. ```xml ``` -------------------------------- ### Symbol File Entry for Uneven Address Structure (Optimized Layout) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_symbolconfiguration.html Displays the symbol file entry for the same uneven address structure with the optimized layout. Note how the 'byteoffset' values change. ```xml ``` -------------------------------- ### Symbol File Entry for Uneven Address Structure (Compatibility Layout) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_symbolconfiguration.html Shows the symbol file representation for a structure with uneven addresses using the compatibility layout. Pay attention to the 'byteoffset' values. ```xml ``` -------------------------------- ### Symbol File Entry for Large Structure (Compatibility Layout) Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_symbolconfiguration.html Shows the resulting symbol file entry for a large structure using the compatibility memory layout option. Note the byte offsets and sizes. ```xml ``` -------------------------------- ### Declare UserConfigurationV1 Variable Source: https://content.helpme-codesys.com/en/CODESYS%20Communication/_comm_use_dynamic_opc_ua_server_comm_settings.html Declare a variable of type DatasourceOpcUaServer.UserConfigurationV1 in static memory to hold the OPC UA server connection settings. ```IEC 61131-3 PROGRAM PLC_PRG VAR config : DatasourceOpcUaServer.UserConfigurationV1 := ( SessionName := 'MyCustomSession', EndpointUrl := 'opc.tcp://DevXY:4840', SecurityPolicyUri := DatasourceOpcUaServer.CmpOpcUaStack_Interfaces.OpcUa_SecurityPolicy_None); value : INT; END_VAR ```