Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

My question would be weird so I do apologize for that.

I am going to implement Modbus RTU Master and Modbus TCP Master in an electronic device Called "DiGi Module Connect Me 9210". From this device I will request some data from PIC, data like Nodes and Temperatures and Some other data. I just want to Implement FC 04/03/16 in my device.

The Digi Module is an electronic device so for this purpose I am going to create C# GUI to request data from the PIC Using GUI via DiGi Module because Digi will be connected with PIC using Modbus RTU Protocol. And after getting the data in Digi we will send that data on cloud using Modbus TCP.

From GUI to DIgI I will have TCP/IP and from DIGI to PIC I will have Modbus RTU and between Cloud and DiGi I will have Modbus TCP.

I want to strip out my data in C# so I will just send request from the GUI to PIC via DIGI (so my DIGI would a bridge between GUI and PIC) to configure the node or get node data from PIC. I have to read almost 9999 registers in one go using 80 request or something else to get the data from 3X / 4X registers. Now the questions are.

☺ How can I strip my data in C#.?

☺ How to implement Modbus RTU/TCP same time in a device or a system.?

☺ How can I read all the 9999 registers via GUI because I might want to read all the RunTime data from the 3X registers.?

☺ How can I write/Read all the 4X registers as well.?

We are also implementing the paging technique so it means that page 0 will have 9999 registers and then page 1 will have 9999 registers. So if I want to read temperatures I have to go to page 0 and read the registers and if I want to read Speed values I have to go to page 1 and check all the registers.?

The GUI would look like some thing

User will add Node Number and then Temperature and Submit the request.

Thanks
Muhammad Azym
Posted
Updated 30-Jul-21 0:47am

1 solution

Use NModbus[^]
See: http://www.mesta-automation.com/modbus-with-c-sharp-libraries-examples/[^].

But you need to see something clear: Modbus/TCP works over TCP/IP, Modbus/RTU works over serial protocols like RS232 and RS485. You can't just mix them. If the digi module is no modbus gateway, it won't work. As I see, the Digi module could be programmed to be a gateway, but do you really want this?
You need to implement on the Digi Modbus/TCP Slave (not master) + Modbus/RTU Master, and Modbus/RTU slave on the PIC - if the PC software will poll the PIC.
However, you could end up much cheaper with a ready-made device. Like this one: http://www.moxa.com/product/MGate_MB3180_3280_3480.htm[^]. Or even cheaper with these: http://www.shjelectronic.com/EthernetModules.htm[^]
Even Digi has it's own gateway: http://www.digi.com/products/serial-servers/industrial-hardened-serial-servers/digioneia[^]

Of course, if this is your desire, go on, and program the Digi. You can implement both Modbus/RTU and Modbus/TCP stacks on it. As the device can host Embedded linux... you could start from this one: http://mbus.sourceforge.net/[^], but could be others out there ready to run.

From protocol's point of view you can read all registers at once, if you want. Don't try to reinvent the wheel, as Modbus is a quite old and widely used industry standard pack. Many things are supporting it, but if you try to add your own fancy things, it won't be compliant anymore, and you will struggle in the future.

For testing you can use the "standard" Modscan32[^] - but it's not worth the price (sorry folks) -, better simply implement your with NModbus.

On the other hand, you don't need Modbus/TCP at all, because you can implement higher level services on the ethernet side. If you strictly need industrial standards, implement OPC UA. If not, put a REST API in place. Far simpler to implement, and to adapt - if the goal is non generic data acquisition.
 
Share this answer
 
v4
Comments
[no name] 25-Sep-15 14:10pm    
This is a cool comprehensive/informative answer, a 5.
Zoltán Zörgő 25-Sep-15 15:11pm    
Thank you
Muhammad Azym 28-Sep-15 3:18am    
Thanks Zoltan,

In case of the TCP/IP between C# GUI and Digi Module I was thinking to make GUI as a client side and Digi as Server side. what do you think should be perfect.?

Thanks
Zoltán Zörgő 28-Sep-15 3:35am    
I got that.
Technically, yes. This is why you would need your digi to be Modbus/TCP slave, as I mentioned.
Still, you should consider other approaches too. If you give us more details about your environment, your business requirements, we could give you other advices.
Muhammad Azym 28-Sep-15 3:52am    
We have a product through which we configured different nodes for temperature and speed sensors. It was previously developed in BASIC but now we are actually developing it in C with the help of external GUI. As I have mentioned above the protocol between PIC and DIGI would be ModbusRTU and in the GUI I would have my tcp/ip client to connect with DIGI. In DIGI I will also have ModbusTCP to send the RunTime Data of sensors in the cloud. I don't think so the company will go for another approach for now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900