⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modbus_ascii.h.txt

📁 44B0modbus_ascii程序要的
💻 TXT
字号:
">#ifndef MODBUS_ASCII_H   
#define MODBUS_ASCII_H    
   
#define BAUD            (57600)    
#define FRAME_START     ('(')    
#define FRAME_END       (')')    
   
   
/****************************************************************/   
//    
//                          接收模块    
//    
/****************************************************************/   
   
//#define RxdBufLen     (1024*4)    
//#define FrameBufLen       (256)    
#define RxdBufLen       (64)    
#define FrameBufLen     (32)    
   
typedef struct   
{   
    char * volatile Start;   
    char * volatile End;   
    volatile int FrameLen;   
}   
FRAMEPT;   
   
typedef struct   
{   
    volatile char Buf[RxdBufLen];           //字节数组    
    char *volatile pWr;   
    volatile int ByteCnt;                           //接收Byte计数器    
    volatile FRAMEPT FramePt[FrameBufLen];  //帧指针数组    
    volatile int FrameCnt;   
    FRAMEPT *volatile pFrameWr;             //指向帧指针数组的写指针    
    FRAMEPT *volatile pFrameRd;             //指向帧指针数组的读指针    
}   
RXDBUF;   
   
int Modbus_GetFrame(char *pBuf);   
void Modbus_Uart1_Init(int mclk,int baud);   
   
   
/****************************************************************/   
//    
//                          发送模块    
//    
/****************************************************************/   
#define TxdBufLen   (256)    
   
typedef struct   
{   
    volatile char Buf[TxdBufLen];   
    char *volatile pWr;   
    char *volatile pRd;   
    volatile int ByteCnt;   
}   
TXDBUF;   
   
int Modbus_WrFrame(const volatile char *pBuf);   
   
#endif    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -