rexhip / rexhip Goto Github PK
View Code? Open in Web Editor NEWExtended modbus library for Siemens PLC's.
Extended modbus library for Siemens PLC's.
Hi there,
I am using this for reading registers from a Promass E300 flowmeter.
I was able to setup the function to read all data from the flowmeter but I am not sure how to setup to write into one register to reset the totalizer on the flowmeter.
#mb_query(mb_addr := 1, mode := #mb_query.c.write.single_holding_reg, data_addr := 5070, data_ptr := #Tot_Reset);
What I would like to do is to Write 1 into a register which would reset the totalizer.
I've been checking out this library to use this for a project where I have multiple modbus RTU devices. They all operate luckily on parity even, however I've already had different parities before (the projects weren't with Siemens however).
However the Modbus RTU CTRL FBs don't expose the parity as a parameter so it could be adapted, but instead it's an element in a FB struct. The FB struct elements however can't be accessed from the program, thus the parity can't be changed without importing the FB into the program and changing the value manually.
So I'd like to propose to expose the parity as an input parameter on the FB, just like you've already exposed operating mode and baud rate. This will make things a lot simplier and reusable, regardless of how vendor devices operate (since some have fixed modbus settings).
While most vendor devices use changable parity or already use even, it would still make it easier to expose the parity, so all devices can be simple integrated.
Hi, I'm trying to use your modbus example project to send some text to an LCD but it won't compile successfully. When using the modbus_rtu_1200 function block, I get an error when compiling which is as follows: "The data type mb_query of the actual parameter does not match the data type mb_query_1 of the formal parameter mb_query". I've attached a screenshot comparing the library block with my test block.
Changing the data type to "mb_query_1" here results in the opposite compilation error, i.e. "The data type mb_query_1 of the actual parameter does not match the data type mb_query of the formal parameter mb_query"
Looking at the control library blocks, mb_rtu1200_ctrl defines the InOut variable mb_query using datatype "mb_query_1" and mb_tcp_ctrl as "mb_query".
Am I doing something wrong? I'm using version 3.4.1 of your library, V16 update 4, and a 1214C PLC on firmware 4.4 - there is a 4.5 firmware update available but I wouldn't have thought that would be the issue here.
#client(DISCONNECT := #conf.disconnect OR #tdiscon.BUSY,
REQ := #mb_query.z.run.state = #EXEC_QUERY
AND NOT #client.BUSY
AND NOT #client.DISCONNECT
AND #client.Connected
AND NOT #ton_timeout.Q,
MB_MODE := #client.MB_MODE,
MB_DATA_ADDR := #client.MB_DATA_ADDR,
MB_DATA_LEN := #mb_query.z.q.data_len,
BUSY => #mb_query.stat.busy,
STATUS => #mb_query.stat.status,
MB_DATA_PTR := #mb_query.z.buffer,
CONNECT := #tcon_ip_v4);
Currently one is not able to check whether a current station block is busy (as in trying to read or write data), this is not exposed directly. However the PLCOpen standard says that async FBs should have a busy output parameter.
I'd like to propose to expose the busy
state just like the Finnish
or Error
variables in the sb.out
struct, so implementors can easily expose whether the remote device is currently getting queried or not.
I've tried to "hack" this together in my own SB by accessing internal variables
IF #mb_query.z.q.mb_addr = #mb_addr THEN
#isBusy := #mb_query.stat.busy;
END_IF;
I'm currently not sure if this works at all, since I'm only able to test this next week.
However I still don't think accessing internal variables is good and thus would like to propose to expose this easily through the library itself.
Hello,
first...Thank you very much for the great job.
Your Libary are very amazing.
I have changed at runnig plc the function block and some db blocks.
After that I become the error code 8180 at MB_COMM_LOAD.
I dont have changed the hardware and at an another plc the same programm works.
Is it possible that the comm_load is only load if I stop the plc?
I cant stop the plc and dont know where does the problem come from...
Hi,
Thank you so much for your effort and time.
I don't know if updated it to TIA Portal V15 version will be a easy thing... but it will reeeeally help!
Thank you again,
I use this good library in S7-1200(6ES7 214-1HG40-0XB0) with 6ES7 241-1CH32-0AB0 serial module.
Now I have a strange problem. Maybe the slave station is not strickly with char time of MDOBUS STANDARD,which is about 3.6ms when baurate 9600 and 8 databit and 1 stopbit and no parity. MB_Comm_Load FB has a static parameter ICHAR_GAP, default is 0 means 3.5 char time using in FB. With 0 set in ICHAR_GAP, i can not get response,Error PIN OF mb_master alway 16#80C8 every communication request. but when i change ICHAR_GAP to 1(or other value not equal 0), it can correct get response. but strange satuation is when ICHAR_GAP set a value not 0, MB_MASTER will in BUSY state for about 6~7s, after this time it can get correct response. I can not determine the problem is about MB_MASTER or about the library. Can some one give some advise?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.