Skip to main content

Adding Dynamic Components

CODESYS Control Win is configured by means of a configuration file (CODESYSControl.cfg).

The cfg file in the installation path contains a reference to the actual configuration file CODESYSControl.cfg in the working directory:

[SysFile]
Windows.WorkingDirectory=C:\ProgramData\CODESYS\CODESYSControlWinV3x64\801BFF8C

In the cfg file in the working directory, you can enter the desired additional components (drivers). Then these are always loaded when CODESYS Control Win is restarted.

You enter a new component in the section [ComponentManager]. It is important that there are no missing entries in the number of all component entries.

[ComponentManager]
...
Component.6=SysCpuBreakpoints
Component.7=<Neue Komponente>
...

See below which components you can add.

Support of optional fieldbus adapters

Driver: CmpHilscherCIFX

This component supports a NetX PC card from Hilscher. For this, you simply have to enter the component "CmpHilscherCIFX" in the configuration file of CODESYS Control Win as follows:

[ComponentManager]
Component.<n>=CmpHilscherCIFX

Then after installing the adapter, you just have to install the driver SysDrv3S.sys when starting the operating system. This is located in the CODESYS installation directory in $\GatewayPLC\Driver for a 32-bit Windows operating system, or in $\GatewayPLC\Driver\x64 for a 64-bit Windows operating system.

Note: The Hilscher configurator SyCon or SYCON.net and the Hilscher driver must not run parallel to CODESYS.

Driver: CmpSoftingProfibus

This component is necessary if you want to use a PROFIBUS master USB interface adapter from Softing Industrial Automation GmbH with CODESYS in an IEC application. It represents the interface between the runtime system and the proprietary driver from Softing, which is used by our driver library IoDrvSoftingPROFIusb. In CODESYS, this library is integrated automatically in the Library Manager when you add a device PROFIusb in the device tree. As a result, you can use and configure the CODESYS runtime system on a Windows PC as a PROFIBUS Master. For more information, see the following: Adding USB Interfaces for PROFIBUS

Driver: CmpBACnet

The component is needed when you want to use the BACnet IP link of CODESYS Control Win. The following entry is necessary in the configuration file:

[ComponentManager]
Component.<n>=CmpBACnet

Driver: CmpPCANBasicDrv

This component implements the link of Peak CAN hardware by means of the PCAN basic API. For installation instructions, see the online help. No configuration file entries are necessary.

Driver: CmpCAACanL2

This component provides a hardware-independent interface for sending and receiving CAN messages. Optional configuration file entries:

[CmpCAACanL2]
;If setting PersistentBaudrate is enabled (0: disabled; 1: enabled)
;the baudrate will be stored into Net.X.DefaultBaudrate (where X equals NetId) when opening the driver.
PersistentBaudrate=1
;Default baudrate for CAN network 0. This baudrate will be used when the network is opened (e.g from CmpBlkDrvCan or CANopen) with the baudrate set to 0.
Net.0.DefaultBaudrate=1000

In the configuration file, a standard baud rate can be saved for each CAN network (physical CAN connection). This standard baud rate is always used when the CL2 function DriverOpenH is called with baud rate 0 and the driver is not open yet. If this configuration file entry is missing, then an error is issued in the cited case because the baud rate is unknown.

The entry is particularly useful in connection with the function PersistenBaudrate which is deactivated by default. If PersistentBaudrate=1, then CODESYS uses the function CmpSettings to write this baud rate in the configuration file at a specific baud rate for each call of DriverOpenH. This has the effect, for example, that the entry Net.0.DefaultBaudrate is changed. This is especially useful when a controller communicates via the CAN block driver. If the baud rate is 0 (0.Baud rate = 0) in CmpBlkDrvCanServer, then the user can change the baud rate of the block driver communication by means of changing the baud rate in the project, downloading the application, and restarting the controller.

Driver: CmpCAASdoClient

This component implements the CANopen SDO client protocol. Optional configuration entries:

[CmpCAASdoClient]
MaxSegmentsPerCycle=0 ; for block download: maximum of sent segments per cycle; 0 means infinity

You can reduce the number of CAN messages that are sent per cycle in a block transfer here. This is necessary when a controller has problems with a series of many CAN frames at the same ID. However, this also limits the performance, causing a block transfer to take more time.

Driver: CmpCAASDOServer

This component implements the CANopen SDO server protocol. Optional configuration file entries:

[CmpCAASdoClient]
MaxSegmentsPerCycle=0 ; for block download: maximum of sent segments per cycle; 0 means infinity

The number of CAN messages that are sent per cycle in a block transfer can be reduced here.

Driver: CmpEL6751CanDrv

This component implements the link of the Beckhoff EL6751 CAN/EtherCAT gateway terminal. As the component implements a CAN Minidriver, you can use the CANL2 component and all CODESYS CAN-based stacks. No configuration file entries are required.

Driver: CmpNetXCanDlDrv

This component is a CAN Minidriver for a NetX CAN adapter. With this driver, CODESYS Control Win can use the CAN libraries from CODESYS GmbH via a NetX adapter.

The configuration of the component in the configuration file of CODESYS Control Win:

[CmpNetXCanDlDrv]
MaxNumberOfCanNetworks=0..n -> number of the CAN networks (number of the NetIds)
NetId.0.Channel=0 -> mapping of the NetId onboard nad NetX channels (see CmpHilscherCIFX)
NetId.0.Board=0

[ComponentManager]
...
Component.6=CmpHilscherCIFX
Component.7=CmpNetXCanDlDrv
...           

Optional communication channels

Driver: CmpBlkDrvCanClient

This component implements a CODESYS block driver for communication of a CODESYS gateway with a CODESYS controller via CAN (service communication). The communication is established by means of the CANopen SDO protocol ("segmented" or "block transfer"). The component CmpBlkDrvCanClient is needed on the gateway side as well as CAN hardware from Peak (for example, a PCAN USB dongle).

A typical configuration in the gateway configuration file is as follows:

[ComponentManager]
Component.1=CmpBlkDrvCANClient
Component.2=CmpCAASdoClient
Component.3=CmpCAACanL2
Component.4=CmpPCANBasicDrv

[CmpBlkDrvCanClient]
CycleTimeMs=1
NumChannels=1               ; Number of block driver instances
0.Name=BlkDrvCanClient
0.NetId=0                   ; CANbus Network Id (0..n)
0.Baudrate=1000             ; CANbus Baudrate in kbit/s
0.NodeId=1                  ; unique NodeId of Gateway
0.BlockTransfer=1           ; Use block transfer for more performance

[CmpCAASdoClient]
MaxSegmentsPerCycle=0       ; for block download: maximum of sent segments per cycle; 0 means infinity
[CmpBlkDrvCanClient]
CycleTimeMs=1
NumChannels=1               ; Number of block driver instances
0.Name=BlkDrvCanClient
0.NetId=0                   ; CANbus Network Id (0..n)
0.Baudrate=1000             ; CANbus Baudrate in kbit/s
0.NodeId=1                  ; unique NodeId of Gateway
0.BlockTransfer=1           ; Use block transfer for more performance

[CmpCAASdoClient]
MaxSegmentsPerCycle=0       ; for block download: maximum of sent segments per cycle; 0 means infinity

Driver: CmpBlkDrvCanServer

This component implements a CODESYS block driver for communication of a CODESYS gateway with a CODESYS controller via CAN (service communication). The communication is established by means of the CANopen SDO protocol ("segmented" or "block transfer"). The component CmpBlkDrvCanServer is needed on the controller side as well as a corresponding CAN Minidriver. A typical configuration in the controller configuration file is as follows:

[Components]
Component.1=CmpAnyCANMiniDriverComponent ; TODO: Replace component name by your CAN Mini driver component
Component.2=CmpBlkDrvCanServer
[Components]
Component.1=CmpAnyCANMiniDriverComponent ; TODO: Replace component name by your CAN Mini driver component
Component.2=CmpBlkDrvCanServer

[CmpCAACanL2]
;If setting PersistentBaudrate is enabled (0: disabled; 1: enabled)
;the baudrate will be stored into Net.X.DefaultBaudrate (where X equals NetId)
;when opening the driver.
PersistentBaudrate=1
;Default baudrate for CAN network 0. This baudrate will be used when the network 
;is opened (e.g from CmpBlkDrvCan or CANopen) with the baudrate set to 0.
Net.0.DefaultBaudrate=1000

[CmpBlkDrvCanServer]
CycleTimeMs=1
0.NetId=0
0.Baudrate=0 ; 0 means: use setting from CmpCAACanL2 section
0.NodeId=10

[CmpCAASdoServer]
MaxSegmentsPerCycle=0 ;for block upload: maximum of sent segments per cycle
;0 means infinity