MODBUS TCP ON YUN, ready t use sketch

Dear All, I'm looking for sketches to use my arduino YUn with modbus TCP protocol. Many of the examples and libraries are based on ethernet sheild, but Yun as different hardware. Does someone know how to help my to find out some sketch, or at least modify the modbus libraries fro ethernet shield to arduino yun?

thank you

bye

can you post some code? I have done some trials with the YUN, porting some code for the ethernet shield and i just replaced the Ethernet Library objects with the Yun objects:

EthernetClient --> YunClient

Hi, everybody. You can give a detailed example of use of modbus tcp library for Arduino YUN? How to read/write down values of registers and coils?

Thanks in advance.

Modbus TCP is almost exactly the same as regular Modbus for serial ports, with the addition of 6 extra bytes at the front of the packet and no CRC.

I've written modbus implementations for various CPU's including PIC's, the libraries for modbus slave and modbus master that I've written in C are available on http://libstock.com/

http://www.libstock.com/projects/view/355/serial-modbus-slave http://www.libstock.com/projects/view/441/serial-modbus-master http://www.libstock.com/projects/view/574/modbus-common-gateway-interface-cgi

These should be quite straight forward to port to Arduino.

fabiosiggi: Dear All, I'm looking for sketches to use my arduino YUn with modbus TCP protocol. Many of the examples and libraries are based on ethernet sheild, but Yun as different hardware. Does someone know how to help my to find out some sketch, or at least modify the modbus libraries fro ethernet shield to arduino yun?

Any such attempt is futile! The Yun's Ethernet (either RJ-45 or WiFi) is not connected to the AVR/Leonardo side of the board, so there isn't anything that those libraries will ever do for you. You need to start to understand the concurrent nature of having two independent CPUs/environments and program for that accordingly...

Ralf

Good afternoon.

I have no wide experience of operation with Arduino controlers, in particular with Arduino YUN. Now I look for an optimum method of the organization of communication of YUN with Modbus OPC server/SCADA/HMI for the Modbus TCP protocol (or RTU/ASCII). From comments I understood that the Modbus TCP protocol can be realized to Arduino of part or to Linux of part of YUN. Thus, as far as I understand, Arduino YUN have some methods of interaction. With the ATMega32u4 controler via the virtual serial port (Micro-USB), in it a case it is necessary to use the class Serial (for Modbus RTU/ASCII). With WiFi and Ethernet modules using Bridge library (for Modbus TCP). If necessary, I can lay out the diagram with the used equipment. I will be grateful to you for any detailed information with the description of the principles of both methods (perhaps with examples), and also for information which will allow me to understand as correctly to organize interaction between Modbus TCP OPC the server and Arduino YUN.

Thanks in advance.

K_SERG_V you are double posting the exact same post in two different forum sections, please don't do that.

I just now replied to this same post of yours in the forum section 'Networking, Protocols, and Devices'.

For others who read this, there is a good library for use on ARM/Intel based systems that is already well proven and can be configured for RTU and TCP, and both at the same time if you wish, as I have tested previously. Libmodbus http://libmodbus.org/documentation/


Paul

RTU is the binary version of Modbus, RTU is not specific to any media. You can have RTU on serial or TCP. The other modbus version is much less common is ASCII, its not used often, but again can be implemeted on serial or TCP.

http://www.simplymodbus.ca/TCP.htm