gijzelaerr / python-snap7

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

Problems getting python-snap7 to work on S7-1200 #80

Closed PaulieTheKid closed 7 years ago

PaulieTheKid commented 7 years ago

Hi,

I installed snap7 and python-snap7 on a raspberry pi3, but I cant get it to work.

I can ping the plc with the pi.

But when I run the example code "boolean.py", I get the following output:

No handlers could be found for logger "snap7.common" Traceback (most recent call last): File "test4.py", line 21, in reading = plc.db_read(31, 120, 1) # read 1 byte from db 31 staring from byte 120 File "/usr/local/lib/python2.7/dist-packages/snap7/client.py", line 142, in db_read check_error(result, context="client") File "/usr/local/lib/python2.7/dist-packages/snap7/common.py", line 65, in check_error raise Snap7Exception(error) snap7.snap7exceptions.Snap7Exception: CLI : function refused by CPU (Unknown error)

I'm a reasonably skilled PLC programmer, but just a beginner at the Raspberry and Pyhon, please help.

Thanks,

Paul

gijzelaerr commented 7 years ago

well it looks like it just says you are not allowed to run the function db_read with that set of parameters? Maybe you don't have enough credentials for that specific PLC or that memory address is in valid?