Frequently Asked Question

How to set up DIS sensors in Codesys
Last Updated 2 years ago


    In this FAQ, we will explain how to install DIS sensors in Codesys. The installation of the Codesys and PLC programming is not included.

    Introduction Codesys


    Codesys is a development environment for programming a controller.

    It is developed and marketed by the German software company CODESYS GmbH.

    The tool is independent of device manufacturers and thus used for hundreds of different controllers, PLCs (programmable logic controllers), PAC (programmable automation controllers), ECUs (electronic control units), controllers for building automation and other programmable controllers mostly for industrial purposes.

    The core of the platform is the IEC-61131-3 programming tool "CODESYS Development System".

    (source: https://www.codesys.com/the-system.html)


    Step 1. Add DIS sensor as a “Device”


    CODESYS manages the installed devices in the device repository. A device repository is a defined location in the file system. In the default CODESYS installation, it is defined with an absolute path as the system repository. You install or uninstall devices in the Device Repository dialog. The system installs a device by reading the device description file. The properties of a device are defined in these files regarding configurability, programmability, and possible connections to other devices.

    You can later use the devices provided in the device repository by adding them to the device tree of your project.

    Choose Tools->Device Repository

    image

    Choose the EDS files and install DIS sensors. You can download the EDS files for your DIS sensors here.

    image
    The installed sensors will be seen under CiA Remote Device.
    image

    Reference:https://help.codesys.com/api-content/2/codesys/3.5.13.0/en/_cds_installing_device/


    Step2. Build a new project


    We use CR711S template as an example to build a new demo project showing you how to set up a CANopen safety sensor in codesys.


    CR711S is a safety controller with CANopen Safety support
    image

    A new demo project named “DIS” is made and the fold tree is listed on the left side.

    image

    Reference:https://help.codesys.com/webapp/_cds_struct_project_creation;product=codesys;version=3.5.17.0



    Step 3 Add devices to the project


    • Under Safety PLC-Communication, you will find the communication bus. Select CAN and right click the mouse.
    • image
    • Click Add Device and select CANbus
    • image

        CANbus is now added as a device under CAN communication

       image

     

    • Right click CANbus and select Add Device
    • image
    • Select CANopen_Manager_SIL2
    • image

        A CANopen SIL2 manager is added.

    image


    • Right click CANopen_manager_SIL2 and click add device. Choose DIS sensor under “Safety Remote Device”
    image

    Two DIS CANS sensors are now added in the project tree.

    image


    • Now you can see the sensor configuration when you click the sensor
    • image

    Step 4. Configure sensors


    Panel for CANS devices
    image

    Panel for CANopen devices
    image

    A detailed documentation of each tab can be found on Codesys website.https://help.codesys.com/webapp/_can_edt_canopen_manager_general;product=core_canbus_configuration_editor;version=3.5.17.0


    • Change sensor parameters via tab "SDOs"


    The object dictionary is defined in the EDS file when you import the device. To understand what each object represents, you need to look it up in the manual of your sensor. You can find the manual here.

    Just choose the object and the subindex and write the value you want to send to the sensor. Codesys will generate the SDOs for you.

    e.g. change filter time via object 300E sub index 01
    image

    Create all SDOs should be unchecked, otherwise the sensor will always be initialized with the default value in the EDS file.

    image
    image



    For CANopen Safety device, tab "SRDOs" and "SRDO CRCs" are used.

    • Configure SRDO parameters via tab "SRDOs "

      In this tab, you can define the safety-oriented data objects (SRDOs). The Receive SRDOs are defined on the left side and the Transmit SRDOs are defined on the right side. Our sensor is configured with Transmit SRDOs.

      The mapping of the SRDO1 is already configured with the default value in the EDS file.
      image


      If you double click the first row, you can see the SRDO properties. The value is already initiated with the default value in the EDS file. Object 1301 is used to configure the communication parameters of SRDO1.image
    • Refresh time is set to 80ms as default. This means every 80ms a new SRDO output is sent.
    • SCT time is set to 2x the Refresh time in default in de Codesys.
    • Read here for more details over the SCT/SRVT/Refresh time

    The mapping of the SRDO1 decides what information is contained in the SRDO1. The SRDO always contains a normal message (0x101) and an inverse message(0x102).

    image
    image

    Message 101 has 2 bytes data, 1st byte = 62100108h and 2nd byte = 62100208h.
    Message 102 also has 2 bytes data, 1st byte = 62110108h and 2nd byte = 62110208h.

    The definition of object 6210 and 6211 can be found in the manual:

    image


    • CRC

    Codesys can detect CRC error and generate SDOs to correct it. E.g. after you change the node ID on general page.

    image

    Now the sensor is configured and you can log in your PLC to check the live outputs.









Please Wait!

Please wait... it will take a second!