?? mbmaster.h
字號:
/****************************************Copyright (c)**************************************************
** 廣州致遠電子有限公司
**
** http://www.21cm.com.cn
**
**
**--------------File Info-------------------------------------------------------------------------------
** File name: MBMaster.h
** Last modified Date: 2005-01-11
** Last Version: 1.0
** Descriptions:
**
**------------------------------------------------------------------------------------------------------
** Created by: ZhouLishan
** Created date: 2005-01-11
** Version: 1.0
** Descriptions:
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/
#ifndef __MBMASTER_H
#define __MBMASTER_H
#include "MB_MFunction.h"
#include "MODBUS.h"
#include "OSFUNfile.h"
/***************************************************
** 使能MODBUS功能代碼
****************************************************/
#define READ_COILS_EN 1 // 讀線圈
#define READ_DIS_INPUT_EN 1 // 讀離散量輸入
#define READ_HOLD_REG_EN 1 // 讀保持寄存器
#define READ_INPUT_REG_EN 1 // 讀輸入寄存器
#define WRITE_SING_COIL_EN 1 // 寫單個線圈
#define WRITE_SING_REG_EN 1 // 寫單個寄存器
#define WRITE_MULT_COIL_EN 1 // 寫多個線圈
#define WRITE_MULT_REG_EN 1 // 寫多個寄存器
#define MASK_WRITE_REG_EN 1 // 處理屏蔽寄存器指令
#define READ_WRITE_REG_EN 1 // 讀寫多個寄存器
#define MAX_FUNCTION (READ_COILS_EN +\
READ_DIS_INPUT_EN +\
READ_HOLD_REG_EN +\
READ_INPUT_REG_EN +\
WRITE_SING_COIL_EN +\
WRITE_SING_REG_EN +\
WRITE_MULT_COIL_EN +\
WRITE_MULT_REG_EN +\
MASK_WRITE_REG_EN +\
READ_WRITE_REG_EN +\
1)
typedef struct __FUNCTION_ARRAY{
uint8 Code;
void (*Function)(void *Response);
}FUNCTION_PACK_PDU;
typedef struct __FUNCTION_DATA_HANDLE{
uint8 Code;
void (*Function)(uint8 *PDUPtr,void *ParameterPtr);
}FUNCTION_DATA_HANDLE;
/* 主機描述 */
typedef struct __MASTER_INFORMATION{
uint8 Address; // 地址
uint8 LineProtocol; // 鏈路層協議
uint16 BaudRate; // 波特率 = BaudRate * 100
uint8 Parity; // 奇偶校驗
uint8 StopBit; // 停止位
uint8* RequestPtr; // 主機請求從幀指針
uint8* ReplyPtr; // 應答幀指針
uint8 Status; // 主機狀態
void *ParPtr; // 參數結構指針
}MASTER_INFORMATION;
uint8 ModbusPoll(uint8 NodeID,uint8 FunctionCode,void *ParameterPtr);
void MBMasterIni(void);
//uint8 MReadHoldingReg(uint8 Adrress,uint8 StartAddr,uint16 Quantity,uint16 *DataPtr);
uint8 IdleModbus(void);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -