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.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
- Posts: 5007
- Thank you received: 1441
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.
Yes, it uses the parameter TOTAL_TRANSACTIONS in the INI file to allocate memory, so there is no programming limitation.Your component seems to be really flexible and virtually "unlimited" as per transactions number isn't it ?
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.
It depends on the link quality and response times.Because it is a user space component did you have any performance feedback on the comunication transactions ?
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.
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.The write modbus functions are performed only on data change ?
Use 2 diferent transactions, one to read and another to write.If I want a data read/write from/to a modbus slave how is managed the communication ?
In the modbus protocol is specified a write/read transaction, but is currently not implemented in mb2hal.
It is correct, the transaction is blocked until response.I mean as should be non simultaneous read/write operations on the same slave are allowed isn't it ?
You are welcome,Thank you.
bigalex
Victor
Please Log in or Create an account to join the conversation.
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
Please Log in or Create an account to join the conversation.
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.Is it possible manage a communication with modbus TCP/IP slaves that have the same ip address ?
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.
In this case as i see in the TSXETG100_Brochure.pdf network example, you have the parameter MB_SLAVE_ID to configure this network.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.
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.
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
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
- Posts: 5007
- Thank you received: 1441
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.
Please Log in or Create an account to join the conversation.
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: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.
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.
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.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.
(no need to install git or compile anything).
buildbot.linuxcnc.org
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
- Posts: 5007
- Thank you received: 1441
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.