树莓派 linux下modbus总结(TCP-modbus,RS232-modbus)

本文介绍了在树莓派上使用Linux环境进行Modbus通信的总结,包括TCP-Modbus和RS232-Modbus的实现。首先通过Anaconda2安装了pyserial和modbus-tk库。接着详细讲述了如何解决lwip-win32-msvc-0.1编译过程中的问题,涉及WinPcap开发包的下载和头文件的添加。最后,讨论了使用socket创建基于LwIP的嵌入式WebServer和Modbus TCP应用的基本步骤与注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

环境 win7 Anaconda2

一、安装pyserial和modbus-tk:
C:\Users\admin>cd C:\Anaconda2

C:\Anaconda2>easy_install pyserial
Searching for pyserial
Best match: pyserial 3.4
Processing pyserial-3.4-py2.7.egg
pyserial 3.4 is already the active version in easy-install.pth
Installing miniterm.py script to C:\Anaconda2\Scripts

Using c:\anaconda2\lib\site-packages\pyserial-3.4-py2.7.egg
Processing dependencies for pyserial
Finished processing dependencies for pyserial

C:\Anaconda2>python
Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

import serial

C:\Anaconda2>easy_install modbus-tk
Searching for modbus-tk
Reading https://pypi.python.org/simple/modbus-tk/
Downloading https://pypi.python.org/packages/80/71/3d8a6596cd65670d4d2beee262d5964deb933614fd7f58a739d5aa0f0332/modb
us_tk-0.5.7.tar.gz#md5=74c02b9b57dc32913da52d020eaf11d3
Best match: modbus-tk 0.5.7
Processing modbus_tk-0.5.7.tar.gz
Writing c:\users\admin\appdata\local\temp\easy_install-z7i_tm\modbus_tk-0.5.7\setup.cfg
Running modbus_tk-0.5.7\setup.py -q bdist_egg –dist-dir c:\users\admin\appdata\local\temp\easy_install-z7i_tm\modbu
s_tk-0.5.7\egg-dist-tmp-4bmk1v
zip_safe flag not set; analyzing archive contents…
Moving modbus_tk-0.5.7-py2.7.egg to c:\anaconda2\lib\site-packages
Adding modbus-tk 0.5.7 to easy-install.pth file
Installed c:\anaconda2\lib\site-packages\modbus_tk-0.5.7-py2.7.egg
Processing dependencies for modbus-tk
Finished processing dependencies for modbus-tk

C:\Anaconda2>python
Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值