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

Adding IO Module to Kbus

WAGOKurt
2016-09-08
2016-09-08
  • WAGOKurt - 2016-09-08

    I would like my python script to add an IO Module (8in/8out) to the k-bus. Here is my code:

    PROJECT = r"C:\Projects\WAGO_Test.project"
    proj = projects.create(PROJECT)
    proj.add("CODESYS_Control_for_PFC200",4096,"0000 0013","3.5.8.10")
    found = proj.find('CODESYS_Control_for_PFC200', False)
    device = found[0]
    kbus = device.find('Pfc200Bus', True)[0]
    kbus.add('_750-1506', 288, '0000 0001', '3.5.8.10')Β  #Β  Β <-- ERROR HERE
    proj.save()
    

    This gives an error however:
    'Exception was raised: The device cannot be added or inserted here'

    What am I doing wrong?
    What method do I use to add an IO device? (I have tried 'kbus.plug =' and that also did not work.)

    Thanks!

     
  • mkeller - 2016-09-08

    Hi WAGOKurt.

    WAGOKurt hat geschrieben:
    What am I doing wrong?
    What method do I use to add an IO device? (I have tried 'kbus.plug =' and that also did not work.)

    I tried to reproduce your scenario and it seems you forgot to add the module ID.

    kbus.add('_750-1506', 288, '0000 0001', '3.5.10.0', '880F_750_1506')
    

    BR
    Martin

     

Log in to post a comment.