Menu

Error while accessing S7-1500

kinces
2016-05-05
2016-05-06
  • kinces

    kinces - 2016-05-05

    Hey dudes,
    We are trying to access the S7-1500 with snap7.
    We've followed the tutorials & the answers in the forum with no luck (we managed to do so in the S7-1200).

    We've used the python version of snap7 (X.py):

    import snap7.client as C
    from snap7.util import *
    import plc as PLC
    import snap7
    
    if __name__ == '__main__':
        myplc = snap7.client.Client()
        myplc.connect("192.168.0.15",0,1)
        print("CON STATUS: ", myplc.get_connected());
        PLC.WriteOutput(myplc,0,3,True)
    

    And we are getting:

    ('CON STATUS: ', True)
    ERROR:snap7.common:CLI : function refused by CPU (Unknown error)
    Traceback (most recent call last):
      File "X.py", line 10, in <module>
        PLC.WriteOutput(myplc,0,3,True)
      File "C:\snap7\plc.py", line 6, in WriteOutput
        data = dev.read_area(0x82,0,byte,1)
      File "C:\snap7\client.py", line 239, in read_area
        check_error(result, context="client")
      File "C:\snap7\common.py", line 65, in check_error
        raise Snap7Exception(error)
    snap7.snap7exceptions.Snap7Exception: CLI : function refused by CPU (Unknown error)
    

    Note that we've unchecked the "Optimized something..." in the block properties and also enabled remote full access (with "GET\PUT...") according to the tutorial.
    But the CPU is still refusing to be remote controlled.

    We will be glad for any help!
    Thanks in advance,
    Kinces.

     
  • Davide Nardella

    Davide Nardella - 2016-05-06

    Try the compiled demo (of your OS) and use Rack=0 and Slot=0 (192.168.0.15,0,0)

     
  • Houman

    Houman - 2017-09-19

    Hello,
    I am going to read the DBarea from PLC S7 1200, for this goal I try to import some of the libraries in to the python but I could not solve this error. I am new in pythone. Can you help me

    import snap7

    from snap7.util import *

    import struct
    import snap7.client

    plc=snap7.client.Client()

    plc.connect('10.1.1.98',0,0)

    area= 0x84
    start=0
    length=1
    bit=0

    byte= plc.read_area(0x82,0,start,length)
    No handlers could be found for logger "snap7.common"
    Traceback (most recent call last):
    File "", line 1, in
    File "/usr/local/lib/python2.7/dist-packages/snap7/client.py", line 242, in read_area
    check_error(result, context="client")
    File "/usr/local/lib/python2.7/dist-packages/snap7/common.py", line 69, in check_error
    raise Snap7Exception(error)
    snap7.snap7exceptions.Snap7Exception: CLI : function refused by CPU (Unknown error)

     

Log in to post a comment.

MongoDB Logo MongoDB