gijzelaerr / python-snap7

A Python wrapper for the snap7 PLC communication library
http://python-snap7.readthedocs.org/
MIT License
632 stars 246 forks source link

Can not use this library to read timers of simatic S7-200 smart PLC #471

Closed Tony642 closed 9 months ago

Tony642 commented 9 months ago

I tried to read timers use read_area function:

read_area(snap7.types.Areas.TM, 0, 37, 2)

Snap7 replied this to me:

"function refused by CPU (Unknown error)"

Then I searched on internet, found a tool able to read timers of 200smart. I used wireshark compare two request data flow. For the request able to get reply, data is:

32 01 00 00 00 54 00 0e 00 00 04 01 12 0a 10 1f 00 01 00 00 1f 00 00 25

And another one can not get reply (generated by snap7) is:

32 01 00 00 08 00 00 0e 00 00 04 01 12 0a 10 1d 00 01 00 00 1d 00 00 25

So, it turns out that python-snap7 doesn't support all the areaTypes of 200smart. 200smart uses 1e and 1f represent counter area and timer area. Could you support this? Many thanks.

nikteliy commented 9 months ago

Hi @Tony642 Python-snap7 is a wrapper, all requests to the PLC are generated by the snap7 library. So, it's better to ask such question there

Tony642 commented 9 months ago

Thanks.