Menu

Reading DB from S7-1500 fails

Arne
2016-08-26
2016-08-28
  • Arne

    Arne - 2016-08-26

    Hi,
    we have problems reading data from an S7-1500 via snap7. We have created a global DB in Tia Portal, set protection level to "no protection", and "access via put/get communication" in project settings is also ticked.

    We manage to establish a connection:

    Connected to  %192.168.88.130 Rack = 0, Slot = 1
    PDU Requested = 480
    PDU Negotiated = 480
    

    We tried to read the DB "Send_DB", which is DB2 in our case, and which holds three variables:

    VarName Type Offset
    W1 word 0.0
    I1 Int 2.0
    B1 Bool 4.0
    byte buffer[66536]
    res = Client->DBRead(2,0,5,&buffer)
    

    res returned the error code for "errCliFunctionRefused".

    We tried several other function calls, for example ReadMultiVars (res returned "errCliFunctionNotAvailable") and ReadArea (also "errCliFunctionRefused").

    We tried different buffer sizes, different WordLengths, different "Amounts", but all attempts failed.
    We would be very grateful for further advice!

    Cheers,
    Arne

     
  • Davide Nardella

    Davide Nardella - 2016-08-27

    The settings are ok but don't forget that the DB must be unoptimized (Into DB broperties the "optimization" option must be unchecked).

    Then, why you are connecting to Slot 1 ?
    Rack and Slot should be both 0 in S71200/1500 systems.

     
  • Arne

    Arne - 2016-08-28

    Hello Davide, thanks a lot for your answer! You were right, we changed the slot to 0. We found the main issue though, which had nothing to do with snap7: We used a different PC to set the project up with TIA, than the one where snap7 runs on. Thus we had set up a wrong IP address in TIA, the PLC rightfully declined requests from other IPs.

    Thanks again, best regards,
    Arne

     

Log in to post a comment.