You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.3 KiB
63 lines
2.3 KiB
4 years ago
|
|
||
|
/*****************************************************************************
|
||
|
update by cc @201501101001
|
||
|
针对多串口 和 单一串口 有区别 每个串口是独立的还是分开的有讲究 程序是复杂的还是软件应用简单是
|
||
4 years ago
|
个需要平衡的事情.d
|
||
4 years ago
|
|
||
|
uartcom/uartlib.c:
|
||
|
公用的函数 和硬件无关
|
||
|
放置串行模式(串口等其他通讯总线类的输出)输出的函数,
|
||
|
一些覆盖模式输出的(lcd等固屏输出的)的也可使用
|
||
|
void Lc_print(void (*L0pf_send_uc)(char ww), char *dat,...)
|
||
|
-----------------------------------------------------------------------------------------
|
||
|
uartcom/uartcom0
|
||
|
和uart相关的通讯协议 com + n
|
||
|
为了适应不同的通讯协议需要不同的uart口来对应 和应用相关
|
||
|
|
||
|
typedef struct _ts_lcm_pro_; 应用协议包的定义? LCM的协议------------
|
||
|
L3_UARTcom0_exp_protocol 解析应用协议
|
||
|
-----------------------------------------------------------------------------------------
|
||
|
uartcom/uprotocol: 主要是为 uartcom + n服务的 驱动层到应用层缓存的过度
|
||
|
公用的串口通讯定义
|
||
|
struct _s_protocol_ 的公共协议包(关键的结构体)的声明------struct _s_protocol_
|
||
|
void L1_uart_2buf(struct _s_protocol_ *p)串行数据保存到缓冲中
|
||
|
--------------------------------------------------------------------------------------------
|
||
|
msp/uartx.c 底层代码 和cpu相关
|
||
|
L0_UART0_Init
|
||
|
UART0_IRQHandler
|
||
|
L0_Usend_uc----------s_at0
|
||
|
-----------------------------------------------------------------------------------------
|
||
|
********************************************************************************/
|
||
|
|
||
4 years ago
|
#include "modbus.h"
|
||
|
#include "../bsp/bsp_config.h"
|
||
|
#include "../ctask/tick.h"
|
||
4 years ago
|
#include "../clib/clib.h"
|
||
|
|
||
4 years ago
|
//MODBUS协议解析函数
|
||
|
//超出D_tp_handle_x_len,不继续保存数据
|
||
|
void L1_s2b_PH4(struct _tp_handler_x *p)
|
||
|
{
|
||
|
//p->modbusstmp = D_sys_now;
|
||
|
if(p->head == 0)
|
||
4 years ago
|
{
|
||
4 years ago
|
p->head = 1;
|
||
|
p->max = D_TPC_HANDLER_X_LEN;
|
||
|
p->sp = p->buf;
|
||
|
p->num = 0;
|
||
|
p->sp[p->num++] = p->reg;
|
||
4 years ago
|
}
|
||
|
else
|
||
|
{
|
||
4 years ago
|
if(p->num < p->max)
|
||
4 years ago
|
{
|
||
4 years ago
|
p->sp[p->num++] = p->reg;
|
||
4 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/******************************************************************************
|
||
|
** End Of File
|
||
|
******************************************************************************/
|
||
|
|