Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Get data from tab "Information" to PLC program

e.kislov
2017-06-16
2017-06-26
  • e.kislov - 2017-06-16

    Hi. I need to get data about some POUs from Device Tree (data from tab "Information) in PLC program.

    Something like that:

    sTargetVersion:=// some system function;
    sEthercatMasterVersion:=// some system function;
    

    Is this possible?

    IMG: 3SFORUM.png

     
  • e.kislov - 2017-06-21

    Edwin, I call on you to help.

     
  • eschwellinger

    eschwellinger - 2017-06-21

    Hi,

    SysTarget.library...
    BR
    Edwin

    IMG: Systarget.jpg

     
  • e.kislov - 2017-06-21

    Thanks, it works for device (PLC).

    But how I can use it for POU from Device Tree? (for example, for Ethercat master device)
    Can you give me a little example?

     
  • Anonymous - 2017-06-23

    Originally created by: KevinR

    Hello e.kislov,

    This is what I've found out after some research:

    The information for the device is read from the device description (dd) file. In the dd file, there can also be specified text translation for the info section. So I think, this text is not loaded to the runtime.

    After some deeper analysis, I've found out that the EtherCat_Master is extending the "IoDrvBase". This FB implements the interface "ICmpIoDrv" with a method called "IoDrvGetInfo". The method requires a "Pointer to Pointer to IoDrvInfo". The structure "IoDrvInfo" includes the var "szFirmwareVersion", which seems to be the same as in the information tab.

    If the driver is implementing the interface "ICmpIoDrv", this might be a quick and dirty solution to read the version. But I don't know if the information is valid.

    See the attached screenshots below, there is also a example code for the EtherCat_Master instance.

    Please let me know if there is a better way, which works for all devices

    BR,
    KevinR

    IMG: stIoDrvInfo.PNG

    IMG: devicedesc.PNG

    IMG: IoDrvInfo.PNG

    IMG: IoDrvBase.PNG

    IMG: EtherCatFB.PNG

    IMG: infotab.PNG

     
  • e.kislov - 2017-06-26

    Hi, KevinR.

    Thanks for interesting information.

    But, to say honestly, it's not solve my problem.
    I say about "Ethercat Master" as example.
    Yes, "IoDrvGetInfo" works for Ethercat Master, but it gives incorrect version for Modbus Master (3.0.0.0 instead real 3.5.10.3).
    Furthermore, it not works for Modbus COM, Modbus Slave, Ethercat Slave, etc. (I also check method GetDeviceInfo, but it does not contain device version).

     

Log in to post a comment.