Modbus Examples?

More
04 Jun 2013 22:11 #35258 by andypugh
Replied by andypugh on topic Modbus Examples?

I have written the mb2hal driver, and Yes, it is experimental


I don't know if you are subscribed to the developers list. If not then you might be interested in this post today:
thread.gmane.org/gmane.linux.distributions.emc.devel/9933

Please Log in or Create an account to join the conversation.

More
05 Jun 2013 00:13 #35268 by Todd Zuercher
Replied by Todd Zuercher on topic Modbus Examples?
Thank you Victor,

I have tested your mb2hal, and as far as I can tell, it seems to work fine for my application . Unfortunately I have not gotten to impliment it on the production machine (an 8 spindle gang router) yet. (lost my round-tuit) Hopefully within a month or so I will have caught up enough with other higher priority work to be able to install it on the machine.

Please Log in or Create an account to join the conversation.

More
05 Jun 2013 03:40 #35271 by VNR
Replied by VNR on topic Modbus Examples?

Your component seems to be really flexible and virtually "unlimited" as per transactions number isn't it ?

Yes, it uses the parameter TOTAL_TRANSACTIONS in the INI file to allocate memory, so there is no programming limitation.
The only limitation is the total elements PER transaction (bits o registers), is hardcoded to 100 because i use a static array in order to simplify programming, but it could be changed.

Because it is a user space component did you have any performance feedback on the comunication transactions ?

It depends on the link quality and response times.
Some tests shows RS-232 115200 8N2 = 250 HZ for a function 3 (read holding registers).
TCPIP 100 mb = 1250 HZ for a function 3.
You could test your bandwidth with INIT_DEBUG=2 (OK confirmation messages) and it will show the "update_HZ" for each transaction.

The write modbus functions are performed only on data change ?

No, the data is always written. Yes, i know it is a waste of bandwidth, but also is a SAFETY precaution if the register is changed internally in the slave and you need to maintain your value. It could be implemented if you need that option.

If I want a data read/write from/to a modbus slave how is managed the communication ?

Use 2 diferent transactions, one to read and another to write.
In the modbus protocol is specified a write/read transaction, but is currently not implemented in mb2hal.

I mean as should be non simultaneous read/write operations on the same slave are allowed isn't it ?

It is correct, the transaction is blocked until response.

Thank you.
bigalex

You are welcome,
Victor

Please Log in or Create an account to join the conversation.

More
05 Jun 2013 16:04 - 05 Jun 2013 16:06 #35277 by bigalex
Replied by bigalex on topic Modbus Examples?
Hi Victor.
I have to say T H A N K ......Y O U again. :)
Your answers are detailed and precise .
So another question .....
Is it possible manage a communication with modbus TCP/IP slaves that have the same ip address ?
I mean if I use a device (gateway) like this I can have more than one modbus serial link slave connected to the gateway that have a unique modbus TCP/IP address .

bigalex :blink:

File Attachment:

File Name: TSXETG100_...hure.pdf
File Size:170 KB
Attachments:
Last edit: 05 Jun 2013 16:06 by bigalex.

Please Log in or Create an account to join the conversation.

More
05 Jun 2013 19:14 #35280 by VNR
Replied by VNR on topic Modbus Examples?

Is it possible manage a communication with modbus TCP/IP slaves that have the same ip address ?

I have never tried that, and i can't figure out how it could be possible because i am thinking that must be a HANDSHAKE problem, two devices responding to the same IP request. It is NOT a mb2hal nor a modbus protocol problem, is a TCPIP problem.
But if you use two devices as shown in Schneider_TSXETG100_eng.pdf i think you could configure two different IP for each device, so the problem is resolved.

I mean if I use a device (gateway) like this I can have more than one modbus serial link slave connected to the gateway that have a unique modbus TCP/IP address.

In this case as i see in the TSXETG100_Brochure.pdf network example, you have the parameter MB_SLAVE_ID to configure this network.

For each transaction in the INI file, you set the same IP and PORT (the gateway ip and port) but differents SLAVE ID's corresponding to each serial device (you have to configure differents slave ID on each serial device). The gateway will convert from TCP to serial, and only the device wich the matched SLAVE ID will respond.

The problem here is a slowdown of bandwidth from TCPIP to serial.
Another possible problem to check is the quality of the serial devices, some have a bad implementation of the modbus protocol and responds to ALL slave ID's, do not filter the matched slave ID. So check this, but i bet Schneider's devices do NOT have that problem.

Regards,
Victor

Please Log in or Create an account to join the conversation.

More
05 Jun 2013 19:59 - 05 Jun 2013 23:52 #35281 by bigalex
Replied by bigalex on topic Modbus Examples?
Excellent ! :woohoo:
On this side I believe that your component is much more effective compared to the modbus communication managed from ClassicLadder.
ClassicLadder ModbusTCP/IP seems to allow only slaves that have different IP address .
And also is "limited" about the "transactions" available for the communication.
And also to have the modbus communication working the GUI of ClassicLadder must be active.
So my "personal" opinion is :
# ClassicLadder modbus communication is a valid option :
a- if you have a well defined and limited number of transactions ;
b- easy to use configuration from the GUI ;
c- more focused as I/O scanning (remote field I/O groupped on islands) so usually read/write register function .

# mb2hal modbus communication is a valid option :
a- if you have to manage more transactions read and/or write on the same slave, different elements coils and/or registers and you have more than one slave to communicate with;
b- more (but not too much) programming skills due to the .INI file creation ;
c- more configuration flexibilty and hal pin explicit naming is available.

What is intriguing is that both can be used at the same time *** with caution of course *** in the way that you can use ClassicLadder modbus
to handle for example a remote field I/O and make some ladder logic and you can use mb2hal to manage the spindle motor drive or multiple
spindles drives as Todd Zuercher is trying to do.

bigalex :blink:
Last edit: 05 Jun 2013 23:52 by bigalex.

Please Log in or Create an account to join the conversation.

More
06 Jun 2013 02:35 - 06 Jun 2013 02:36 #35293 by Todd Zuercher
Replied by Todd Zuercher on topic Modbus Examples?
No one has really answered this question.

What would it take to install mb2hal to Linuxcnc Version 2.5?

I know I would need to install libmodbus3, but after that, then what?

I know I can get it from installing master from git. But I think I would prefer to stick with a regular release version on a production mahcine.
Last edit: 06 Jun 2013 02:36 by Todd Zuercher.

Please Log in or Create an account to join the conversation.

More
06 Jun 2013 05:12 #35298 by VNR
Replied by VNR on topic Modbus Examples?

No one has really answered this question.
What would it take to install mb2hal to Linuxcnc Version 2.5?
I know I would need to install libmodbus3, but after that, then what?
I know I can get it from installing master from git. But I think I would prefer to stick with a regular release version on a production mahcine.

Not sure because there are some months that i do not touch GIT and i do not update my current installation, so i forget some things, but as i remember this is possible:
In a official stable release 2.5.x:
1) Install libmodbus3
2) install git
3) download master .
4) Compile but do NOT install (keep the current 2.5.x stable version).
5) Manually install (copy) the mb2hal driver, it should be compatible.

OR, in a production machine:
1) install libmodbus3
2) Copy mb2hal from the testing machine.

hope it helps,
Victor

Please Log in or Create an account to join the conversation.

More
06 Jun 2013 05:36 #35299 by andypugh
Replied by andypugh on topic Modbus Examples?

I know I would need to install libmodbus3, but after that, then what?
I know I can get it from installing master from git. But I think I would prefer to stick with a regular release version on a production mahcine.

If you were to get master as a precompiled binary from the buildbot, then after recent changes to the build system you should automatically have libmodbus3 and mb2hal.
(no need to install git or compile anything).
buildbot.linuxcnc.org

Please Log in or Create an account to join the conversation.

More
06 Jun 2013 09:07 #35313 by Todd Zuercher
Replied by Todd Zuercher on topic Modbus Examples?
At least as of a couple of weeks ago installing master from buildbot did not give me mb2hal. I had to use git. (but it is possible that I might not have had the libmodbus3 installed properly which might have prevented mb2hal from installing)

Where would I copy the mb2hal files to on a standard 2.5x install? This seems too simple, is there some thing more that must be done to make the system aware of its presence?

Please Log in or Create an account to join the conversation.

Time to create page: 0.210 seconds
Powered by Kunena Forum