You are not logged in.
Pages: 1
Topic closed
Hi everyone,
I am looking for method to read more than 16 variables from a Modbus slave (TCP). In 'special edit' window I can set higher value than 16 ('Count' field) but how do I get them into my task?
Biggest object is INHEXD from inoutlib, is there any other option?
I'd like to avoid making many small queries to my Modbus slave device.
btw
Can anybody explain last three options in 'special edit' modbus config window?
"Join next" "Multi command" "Passive"
Sorry if it's trivial question but I'm quite new to modbus communication..
Regards
Hubert
Offline
Hi Hubert,
thank you for your question. It is possible to reduce number of queries to your device by creating item as either Read Multiple Registers (function code 3) or Write Multiple Registers (function code 16) with parameter "Count" set to the desired value (maximum is 125 values). Or even Read/Write Multiple Registers (function code 23) if your device support it.
This item can be splitted into smaller meaningful items without any need of new queries. You just need to add new item(s) and set it as passive.
For more details about "Passive" and other parameters see:Modbus communication driver - User Guide
Note: Please, be sure that your device supports the Modbus functions you are about to use. Unfortunately there are some devices which supports only Multiple commands or only Single Commands - it depends on the manufacturer. For list of Modbus functions see for example: https://en.wikipedia.org/wiki/Modbus#Su … tion_codes
If you require any further information, feel free to contact us.
Regards, Tomas
Last edited by jaroslav_sobota (2016-10-06 18:46:07)
Offline
Hi Tomas,
thank you for explanation.
Sorry, i didn't found Modbus driver Users Guide before.
I will try "Passive" parameter and let you know if it works for me.
Regards
Hubert
Offline
Hi Hubert,
you are welcome. Hope that you will succeed with your project
Let us know if you will need any more assistance.
Regards, Tomas
Offline
Hello again,
so I've tried "Passive" method and it's working!
But I have some thoughts/issues:
1. When setting group of items (for example readings in modbus driver config) with one non-passive and rest passive items you have to remember, that properties for passive items are inherited from non-passive one.
For example: when non-passive item is integer signed value, all passive below this one will be also integer signed. It is not possible to set passive value as a different type.
2. Sometimes modbus slave device do not like many frequent queries, and you DO NEED frequent readouts. That is my case.
When I tried to set up many queries I was trying to setup different refresh rates, different order (move up/move down) but still I had many problems with errors and warnings (timeouts, bind errors, other). When only one active item was set up everything works perfectly, even with small refresh rate.
In addition, the signal I couldn't read with passive method was needed not often, refresh rate for this item could be x100 or even x1000 more that the others.
So I came up with solution: use __ReadEnable attributes and setup timer/clock to once a while turn off reading the frequent item and turn on reading for not-frequent item - just for one cycle period.
Right now I am trying it manually and I faced some problem:
In config both items are set to "Readable" (I can't leave this blank in modbus driver config window - compile error), in my task i set up items like this:
[CNB_def_ON]-----[MTM__itemFrequent__ReadEnable]
\
------[NOT_]----[MTM__itemNotFrequent__ReadEnable]
At the beginning the itemFrequent reading is working OK (one active with many passive vals).
Readings from itemNotFrequent are "BAD, Out of service" - but I understand that, I disabled it by __ReadEnable attr.
And when I switch CNB_def_ON to OFF everything still working fine (well, fine means in a way I presumed )
Readings from itemFrequent are not updated (last read value is present), and itemNotFrequent is working fine.
But when I switch CNB_def_ON to ON again something not good is happening: values from itemNotFrequent has status "BAD, Out of service" and value is '0'.
Readings from itemFrequent are fine again.
I was hoping when i switch CNB_def_ON back to ON position, the Input Block with readings from itemNotFrequent will hold last read registers.
Of course I can get around this problem, but it will be nice to now why it is happening - is this a bug?
Regards
Hubert
PS
Sorry if something in my description is not clear, if so please let me know!
Offline
Hello Hubert,
thanks for your extensive post. We'll have to analyze your issues thoroughly. Both seem like bugs.
At the moment I just want to mention the Period parameter in Modbus configuration dialog, which you can use for less frequent reading of items. The default Period=0.0 means that the item is read with the period of the Modbus driver itself, but for e.g. Period=60.0 the item will be read only once per minute. Moreover, because your slave device apparently has problems processing multiple Modbus commands, you should set Max. requests=1 in the Slave station configuration. Then the master will only send 1 request at a time.
Hope this helps for now. We'll get back to you soon.
Jaroslav
Monarco HAT for Raspberry Pi - Lightweight I/O for monitoring, archiving and control.
Raspberry Pi in industrial automation!
Offline
Hi Jaroslav,
please clarify what do you mean by "Period" settings?
Do you mean Refresh rate for specific item? Or factor setting in MTM Block properties window?
btw I found out that max value for Refresh rate is about 20 seconds - if I enter more it seems to overflow to negative value.
I definitely try changing "Max requests" settings for the modbus slave.
Thanks!
Regards
Hubert
Offline
Hi Hubert,
yes I mean the Refresh period for specific item. The corresponding column in the lower table is called Period, that's why the confusion, sorry about that.
The maximum Refresh period is 32.767 seconds and yes, you have just found a bug. Thanks!
Jaroslav
Monarco HAT for Raspberry Pi - Lightweight I/O for monitoring, archiving and control.
Raspberry Pi in industrial automation!
Offline
Wow, I'm glad i could help with something
And tried reduce "Max requests" for my slave device to 1 - and it solved my issues!
Thank you!
So I don't need my sophisticated '__ReadEnable attribute' method, but anyway let me know about that later.
Hubert
Offline
Pages: 1
Topic closed