
#ifndef _MODBUS_H_
#define _MODBUS_H_




typedef struct
{
		unsigned char	Buff[300];     
		unsigned char Length;					     
		unsigned char DataSource;            
}UART_DATA_TPDF;









typedef struct
{
		
		unsigned char ReceiveBuffer[200];
		unsigned char ReceiveLength;

		unsigned char ExceptionCode;
	
		unsigned char TransmitBuffer[200];
		unsigned char TransmitLength;
		void (*FunctionPostResponse)(void);
}MODBUS_PARAMETER;



typedef enum
{
		EXCEPTION_CODE_NULL = 0,
		EXCEPTION_CODE_1 		= 1,
		EXCEPTION_CODE_2 		= 2,
		EXCEPTION_CODE_3 		= 3,
		EXCEPTION_CODE_4 		= 4,
		EXCEPTION_CODE_5 		= 5,
}MODBUS_EXCEPTION_CODE_ENUM;
typedef struct
{
		unsigned char FunctionCode;
		MODBUS_EXCEPTION_CODE_ENUM (*FunctionPtr)(void);
}MODBUS_CODE_FUNCTION_TPDF;



typedef enum 
{
		MB_BIT_03 = 0x00000001,           
		MB_BIT_06 = 0x00000002, 
		MB_BIT_10 = 0x00000004,      
}MODBUS_FUNCTON_ENUM;


typedef struct 
{
		unsigned short BaseAddr;
		unsigned short Length;
		void* Pointer;
		unsigned int FunctionBit;
		void (*preReadCallback) (void);
		void (*postReadCallback) (void);
		void (*preWriteCallback) (void);
		void (*postWriteCallback) (unsigned short TempDataAddr,unsigned short TempData);
		void (*preMultipleWriteCallback) (void);
    void (*postMultipleWriteCallback) (void);
}MODBUS_PARAMETER_INFO_TPDF;



extern MODBUS_PARAMETER ModbusParameter;

void MODBUS_Process(unsigned char* TempPtr,unsigned char Length);
#endif


