修改
This commit is contained in:
1 parent
ccd0acd07b
commit
60157f1290
33 files changed
+402
-66
No files matched your search
+1
-1
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus.h>
|
||||
* mb_sample_rtu_master.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -8,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "rtthread.h"
|
||||
#include "modbus.h"
|
||||
|
||||
#ifdef MB_USING_SAMPLE_RTU_MASTER
|
||||
|
||||
+1
-1
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus.h>
|
||||
* mb_sample_rtu_slave.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -8,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "rtthread.h"
|
||||
#include "modbus.h"
|
||||
|
||||
#ifdef MB_USING_SAMPLE_RTU_SLAVE
|
||||
|
||||
+1
-1
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus.h>
|
||||
* mb_sample_tcp_master.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -8,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "rtthread.h"
|
||||
#include "modbus.h"
|
||||
|
||||
#ifdef MB_USING_SAMPLE_TCP_MASTER
|
||||
|
||||
+1
-1
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus.h>
|
||||
* mb_sample_tcp_slave.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -8,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "rtthread.h"
|
||||
#include "modbus.h"
|
||||
|
||||
#ifdef MB_USING_SAMPLE_TCP_SLAVE
|
||||
|
||||
+1
-1
@@ -1,5 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus.h>
|
||||
* mb_sample_tcp_slave.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -10,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "rtthread.h"
|
||||
#include "modbus.h"
|
||||
|
||||
#ifdef MB_USING_SAMPLE_TCP_SRV_SLAVE
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus.h>
|
||||
#include <packages/qmodbus/inc/modbus_cvt.h>
|
||||
#include <packages/qmodbus/inc/modbus_port.h>
|
||||
* modbus.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -11,6 +8,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "modbus.h"
|
||||
#include "modbus_cvt.h"
|
||||
#include "modbus_port.h"
|
||||
|
||||
#ifdef MB_USING_RAW_PRT
|
||||
static void mb_raw_prt(bool is_send, const u8 *pdata, int dlen)//原始数据打印
|
||||
@@ -7,14 +7,13 @@
|
||||
*/
|
||||
|
||||
#ifndef __MODBUS_H__
|
||||
|
||||
#define __MODBUS_H__
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_cvt.h>
|
||||
#include <packages/qmodbus/inc/modbus_rtu.h>
|
||||
#include <packages/qmodbus/inc/modbus_tcp.h>
|
||||
#include <packages/qmodbus/inc/modbus_port.h>
|
||||
#include <packages/qmodbus/inc/modbus_backend.h>
|
||||
#include "modbus_cvt.h"
|
||||
#include "modbus_rtu.h"
|
||||
#include "modbus_tcp.h"
|
||||
#include "modbus_port.h"
|
||||
#include "modbus_backend.h"
|
||||
|
||||
#ifdef MB_TCP_FRM_MAX
|
||||
#define MB_BUF_SIZE MB_TCP_FRM_MAX
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus_backend.h>
|
||||
#include <packages/qmodbus/inc/modbus_port.h>
|
||||
* modbus_backend.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -10,6 +8,8 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "modbus_backend.h"
|
||||
#include "modbus_port.h"
|
||||
|
||||
|
||||
#ifdef MB_USING_RTU_BACKEND
|
||||
@@ -7,11 +7,10 @@
|
||||
*/
|
||||
|
||||
#ifndef __MODBUS_BACKEND_H__
|
||||
|
||||
#define __MODBUS_BACKEND_H__
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_cfg.h>
|
||||
#include <packages/qmodbus/inc/typedef.h>
|
||||
#include "modbus_cfg.h"
|
||||
#include "typedef.h"
|
||||
|
||||
#define MB_BKD_ACK_TMO_MS_DEF 300
|
||||
#define MB_BKD_BYTE_TMO_MS_DEF 32
|
||||
File renamed without changes.
@@ -6,7 +6,7 @@
|
||||
* 2024-04-02 qiyongzhong first version
|
||||
*/
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_crc.h>
|
||||
#include "modbus_crc.h"
|
||||
|
||||
static const u16 mb_crc_table[] = {
|
||||
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
|
||||
@@ -7,10 +7,9 @@
|
||||
*/
|
||||
|
||||
#ifndef __MODBUS_CRC_H__
|
||||
|
||||
#define __MODBUS_CRC_H__
|
||||
|
||||
#include <packages/qmodbus/inc/typedef.h>
|
||||
#include "typedef.h"
|
||||
|
||||
#define MB_CRC_INIT_VOL 0xFFFF
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* 2024-04-01 qiyongzhong first version
|
||||
*/
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_cvt.h>
|
||||
#include "modbus_cvt.h"
|
||||
|
||||
int mb_cvt_u8_put(u8 *buf, u8 val)
|
||||
{
|
||||
@@ -7,10 +7,9 @@
|
||||
*/
|
||||
|
||||
#ifndef __MODBUS_CVT_H__
|
||||
|
||||
#define __MODBUS_CVT_H__
|
||||
|
||||
#include <packages/qmodbus/inc/typedef.h>
|
||||
#include "typedef.h"
|
||||
|
||||
int mb_cvt_u8_put(u8 *buf, u8 val);
|
||||
int mb_cvt_u8_get(const u8 *buf, u8 *pval);
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus.h>
|
||||
#include <packages/qmodbus/inc/modbus_cvt.h>
|
||||
#include <packages/qmodbus/inc/modbus_port.h>
|
||||
* modbus_master.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -10,6 +7,9 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "modbus.h"
|
||||
#include "modbus_cvt.h"
|
||||
#include "modbus_port.h"
|
||||
|
||||
#ifdef MB_USING_MASTER
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus_cvt.h>
|
||||
#include <packages/qmodbus/inc/modbus_pdu.h>
|
||||
* modbus_pdu.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -9,6 +7,8 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "modbus_pdu.h"
|
||||
#include "modbus_cvt.h"
|
||||
|
||||
static int mb_pdu_except_make(u8 *buf, const mb_pdu_except_t *exc)
|
||||
{
|
||||
@@ -7,10 +7,9 @@
|
||||
*/
|
||||
|
||||
#ifndef __MODBUS_PDU_H__
|
||||
|
||||
#define __MODBUS_PDU_H__
|
||||
|
||||
#include <packages/qmodbus/inc/typedef.h>
|
||||
#include "typedef.h"
|
||||
|
||||
#define MB_PDU_SIZE_MIN 2 //最小pdu尺寸
|
||||
#define MB_PDU_SIZE_MAX 253 //最大pdu尺寸
|
||||
@@ -7,10 +7,9 @@
|
||||
*/
|
||||
|
||||
#ifndef __MODBUS_PORT_H__
|
||||
|
||||
#define __MODBUS_PORT_H__
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_backend.h>
|
||||
#include "modbus_backend.h"
|
||||
|
||||
#define MB_ASSERT(x) //ASSERT(x)
|
||||
#define MB_WEAK __attribute__((weak))
|
||||
@@ -6,7 +6,7 @@
|
||||
* 2024-04-02 qiyongzhong first version
|
||||
*/
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_port.h>
|
||||
#include "modbus_port.h"
|
||||
|
||||
#ifdef MB_USING_PORT_LINUX
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* 2024-04-02 qiyongzhong first version
|
||||
*/
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_port.h>
|
||||
#include "modbus_port.h"
|
||||
|
||||
#ifdef MB_USING_PORT_RTT
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* 2024-04-02 qiyongzhong first version
|
||||
*/
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_port.h>
|
||||
#include "modbus_port.h"
|
||||
|
||||
#ifdef MB_USING_SLAVE
|
||||
MB_WEAK int mb_port_read_disc(u16 addr, u8 *pbit)//读离散量输入, 返回 : 0-成功, -2-地址错误
|
||||
@@ -6,9 +6,9 @@
|
||||
* 2024-04-01 qiyongzhong first version
|
||||
*/
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_crc.h>
|
||||
#include <packages/qmodbus/inc/modbus_cvt.h>
|
||||
#include <packages/qmodbus/inc/modbus_rtu.h>
|
||||
#include "modbus_rtu.h"
|
||||
#include "modbus_crc.h"
|
||||
#include "modbus_cvt.h"
|
||||
|
||||
#ifdef MB_USING_RTU_PROTOCOL
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
*/
|
||||
|
||||
#ifndef __MODBUS_RTU_H__
|
||||
|
||||
#define __MODBUS_RTU_H__
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_cfg.h>
|
||||
#include <packages/qmodbus/inc/modbus_pdu.h>
|
||||
#include "modbus_cfg.h"
|
||||
#include "modbus_pdu.h"
|
||||
|
||||
#ifdef MB_USING_RTU_PROTOCOL
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
#include <packages/qmodbus/inc/modbus.h>
|
||||
#include <packages/qmodbus/inc/modbus_cvt.h>
|
||||
#include <packages/qmodbus/inc/modbus_port.h>
|
||||
* modbus_slave.c
|
||||
*
|
||||
* Change Logs:
|
||||
@@ -10,6 +7,9 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "modbus.h"
|
||||
#include "modbus_cvt.h"
|
||||
#include "modbus_port.h"
|
||||
|
||||
#ifdef MB_USING_SLAVE
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* 2024-04-01 qiyongzhong first version
|
||||
*/
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_cvt.h>
|
||||
#include <packages/qmodbus/inc/modbus_tcp.h>
|
||||
#include "modbus_tcp.h"
|
||||
#include "modbus_cvt.h"
|
||||
|
||||
#ifdef MB_USING_TCP_PROTOCOL
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
*/
|
||||
|
||||
#ifndef __MODBUS_TCP_H__
|
||||
|
||||
#define __MODBUS_TCP_H__
|
||||
|
||||
#include <packages/qmodbus/inc/modbus_cfg.h>
|
||||
#include <packages/qmodbus/inc/modbus_pdu.h>
|
||||
#include "modbus_cfg.h"
|
||||
#include "modbus_pdu.h"
|
||||
|
||||
#ifdef MB_USING_TCP_PROTOCOL
|
||||
|
||||
File renamed without changes.
Reference in new issue
Block a user