您如何与iPhone应用程序中的Modbus设备通信? [英] How do you communicate to a Modbus device within an iPhone application?

查看:78
本文介绍了您如何与iPhone应用程序中的Modbus设备通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够开发一个可以与Modbus设备通信的iPhone应用程序,但是我不确定该如何进行.有没有人对此有经验,或者为此目的有现有的库吗?

I would like to be able to develop an iPhone application that can communicate with Modbus devices, but I'm not sure how to proceed. Has anyone had experience with this or are there existing libraries out there for this purpose?

推荐答案

您首先需要知道如何在iPhone上创建简单的TCP客户端,以及在计算机上通过iPhone客户端与之通信的简单TCP服务器.无线上网.确保在任何客户端/服务器实验之前PING命令都有效并且防火墙不会阻止您的服务器端口,并确保用于实验的服务器端口大于1024,并且尚未使用.然后看看官方站点上的MODBUS TCP规范,熟悉您感兴趣的功能代码,并研究C代码,此处.然后创建一个简单的MODBUS TCP客户端,该客户端可以将请求发送到MODBUS TCP服务器并解释答案.最好的方法是开始读取单个寄存器的值,然后及时进行并添加更多功能.

You will need first to know how to make a simple TCP client on your iPhone, and a simple TCP server on your computer that your iPhone client will talk to via WiFi. Make sure PING command works and firewall does not block your server port before any client/server experiments, and make sure that server port for experimenting is greater then 1024 and not already used. Then take a look at MODBUS TCP specification from official site, get familiar with function codes you are interested in, and study C code found here. Then make a simple MODBUS TCP client that can send a request to MODBUS TCP server and interprete an answer. The best way is to start reading single register value, then progress in time and add more functions.

这篇关于您如何与iPhone应用程序中的Modbus设备通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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