做完上述步骤可以看见在"~/libmodbus_install"生成了头文件及库文件
dengxm2024@PC-202105142413:~/libmodbus_install$ ls
include lib share 3.使用上面输出的库
新建文件/home/dengxm2024/linuxProgDir/imx280astudy/userside_code/libmodbustest/version.c
root@EasyARM-iMX28x ~# ./version
Compiled with libmodbus version 3.1.4 (030104)
Linked with libmodbus version 3.1.4
The functions to read/write float values are available (2.1.0).
Oh gosh, brand new API (2.1.1)!
至此,使用libmodbus库进行开辟的开端步骤就完成了。
测试modbus主站代码:
/home/dengxm2024/linuxProgDir/imx280astudy/userside_code/libmodbustest/modbustcpclient.c