MODBUS RTU的VB代码 [英] VB code for MODBUS RTU

查看:450
本文介绍了MODBUS RTU的VB代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将能量计连接到PC,并希望使用VB代码接收excel文件上的电气数据。电表支持的协议是MODBUS RTU。需要一个示例代码来完成这项任务。

提前谢谢你

i want to connect a Energy meter to PC and want to receive electrical data on excel files using VB code. the protocol supported by energy meters is MODBUS RTU. need a sample code to do this task.
Thank you in advance

推荐答案

请看我对这个问题的评论。



原则上,您可以使用.NET P / Invoke包装可用的C库MODBUS库: http://www.protocessor.com/solutions/Free-Modbus-RTU-Source-Code.php [ ^ ],

http://libmodbus.org [ ^ ]。



但是你可以找到可用的原生.NET库。请参阅:

http://modbus.codeplex.com [ ^ ],

http://www.modbustools.com/modbus_wsmbt.asp [ ^ ],

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

http://code.google.com/p/nmodbus [ ^ ]。



另请参阅这些CodeProject文章:

C#/ .NET 2.0中的简单Modbus协议 [ ^ ],

Modbus TCP类 [ ^ ]。



我希望你不会因为使用C#代码而不是VB.NET而造成问题;这真的无所谓;严肃图书馆的开发人员很难处理像VB.NET这样的非标准语言。



-SA
Please see my comment to the question.

In principle, you can wrap the available C library MODBUS library using .NET P/Invoke: http://www.protocessor.com/solutions/Free-Modbus-RTU-Source-Code.php[^],
http://libmodbus.org[^].

But you can find available native .NET library. Please see:
http://modbus.codeplex.com[^],
http://www.modbustools.com/modbus_wsmbt.asp[^],
http://www.mesta-automation.com/modbus-with-c-sharp-libraries-examples[^],
http://code.google.com/p/nmodbus[^].

See also these CodeProject articles:
Simple Modbus Protocol in C# / .NET 2.0[^],
Modbus TCP class[^].

I hope you are not going the make a problem because of having C# code instead of VB.NET; it does not really matter; developers of serious library hardly will deal with non-standard language like VB.NET.

—SA


我在.Net上使用相同的代码。<<( [ ^ ])>>。我有一台PLC通过Modbus RTU(RS485)连接到PC。在PLC和PC之间我有一个RS485-RS232-USB转换器。



我想知道这个程序如何读写4字节(2字)大小的内存寄存器。我需要处理浮点数据类型的内存寄存器和其他负值的内存寄存器。我有一个带有下一个寄存器(Dropbox图像)的PLC,我需要读写,所以如果你能给我一些帮助,我会很高兴。



这是与PLC寄存器的链接<<( [ ^ ])>>



谢谢!。
Hi, I'm using the same code for this on .Net <<([^])>>. I have a PLC connected to a PC through Modbus RTU (RS485). Between PLC and PC I have a RS485-RS232-USB converter.

I'd like to know how this program could read and write memory registers of 4 bytes (2 words) size. I need to handle memory registers with float data type and others with negative values. I have a PLC with the next registers (dropbox image) that I need to read and write, so I'll be very pleased if you could give me some help with this.

This is the link with the PLC registers <<([^])>>

Thanks!.


这篇关于MODBUS RTU的VB代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆