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

Change "Always update variables" in PLC settings by scripting

2017-08-22
2017-08-28
  • danielesdei - 2017-08-22

    Hello,

    I would like to set by Python script the PLC setting "Always update variables" to "Enabled 2 (always in bus cycle task)". Is there a way?

    In the attachment a screenshot of the UI equivalent.

    Thanks in advance.

    Best Regards,
    Daniele

    IMG: PLC settings.PNG

     
  • mkeller - 2017-08-28

    Hi Daniele.

    danielesdei hat geschrieben:
    I would like to set by Python script the PLC setting "Always update variables" to "Enabled 2 (always in bus cycle task)". Is there a way?

    CDS-53974

    proj = projects.primary
    found = proj.find('Device', True)
    if not found:
    Β  Β raise Exception('No device found')
    dev = found[0]
    driverinfo = dev.driver_info
    if not driverinfo:
    Β  Β raise Exception('No driver info present')
    driverinfo.always_update_variables = AlwaysUpdateVariablesMode.AlwaysInBusCycle
    

    BR
    Martin

     

Log in to post a comment.