Closed biswaKL closed 4 years ago
I am getting message like:
CLI : function refused by CPU (Unknown error)
What code are u using to read the db? Maybe in the plc program the blocks have check the optimized block, which will cause problems. If you are using get_db function, try to use db_read( n_db, start, length)
Indeed this could have multiple issues:
Here are the notes from snap7 about this topic:
S7 1200/1500 Notes
An external equipment can access to S71200/1500 CPU using the S7 “base” protocol, only working as an HMI, i.e. only basic data transfer are allowed.
All other PG operations (control/directory/etc..) must follow the extended protocol, not (yet) covered by Snap7. Particularly to access a DB in S71500 some additional setting plc-side are needed.
- Only global DBs can be accessed.
- The optimized block access must be turned off.
- The access level must be “full” and the “connection mechanism” must allow GET/PUT.
I reporigrammed the PLC, and i am able to read now using db_read.
Now my question is can i use: "DB1.DBD42" directly instead of giving address and size.
I don't know if such a feature already exist (especially if this repo shall just be a wrapper), but you may make your own methods.
You can parse yourself the string into DBnumber (1), Start (here 42), Size (DBD) (there you make yourself a dict of datasizes of word, byte etc., don't forget the endian stuff! and compare it) and this should be it. Then you throw all the stuff in e.g. db_read()
and that should be it.
you could write yourself a function to read using "DB1.DBD42" I suggest using regex
r'DB([0-9]+)\.DB([DXBW])([0-9]+)\.?([0-9]+)?' ##<-- starting point, you will get the DB number, Type of data, offset or byte and bit if it has
Did this solve your issue?
yes its resolved now. sorry i forgot to close. thanks everyone for your help.
On Fri, Sep 11, 2020 at 12:49 PM Gijs Molenaar notifications@github.com wrote:
Did this solve your issue?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gijzelaerr/python-snap7/issues/185#issuecomment-690922760, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJX3WPF3LCLBFRB2XR2HNLSFHFP5ANCNFSM4QBSHEUQ .
-- Thanks and Regards,
[image: Knowledge Lens Pvt. Ltd.] https://www.knowledgelens.com http://www.knowledgelens.com Biswajit Sahu Senior Tech. Lead Mobile: +919124392903
Our Expertise: Big Data | Artificial Intelligence | Internet of Things ||Our Expertise: Our Products: GLens | iLens | MLens |AiLens | SearchLens
Hii., Is it python - Snap7 will works for acquiring real,int,dint,bool data from S7300 CP343-1 Lean module
Hi Team,
I have a S7-1200 with me, i cant code it. Programmer uploaded the code and left. He gave me the register address which i am trying to read, but not happening.
these are the address: DB1.DBW0, DB1.DBW1, DB1.DBW2, DB1.DBD42
Can any one please tell me how to read these.