Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

modbus_defs.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*/
00015 /*---------------------------------------------------------------------------*/
00016 
00017 #ifndef MODBUS_DEFS_H
00018 #define MODBUS_DEFS_H
00019 
00020 typedef unsigned char                           u8;
00021 typedef unsigned short                          u16;
00022 typedef unsigned long                           u32;
00023 
00024 #define U32_MAX_VALUE                           0xFFFFFFFF
00025 
00026 #define MB_TCP_PORT                             502
00027 #define MB_RTU_ADU_MAX_LENGTH                   256
00028 #define MB_ASCII_ADU_MAX_LENGTH                 512
00029 
00030 #define MB_RTU_PROTOCOL                         0
00031 #define MB_ASCII_PROTOCOL                       1
00032 #define MB_TCP_PROTOCOL                         2
00033 
00034 #define MAX_BUFFER_SIZE                         256
00035 #define MAX_485_NUM                             256
00036 
00038 #define MBF_READ_DECRETE_INPUTS                 0x02
00039 #define MBF_READ_COILS                          0x01
00040 #define MBF_WRITE_SINGLE_COIL                   0x05
00041 #define MBF_WRITE_MULTIPLE_COILS                0x0F
00042 #define MBF_READ_INPUT_REGISTERS                0x04
00043 #define MBF_READ_HOLDING_REGISTERS              0x03
00044 #define MBF_WRITE_SINGLE_REGISTER               0x06
00045 #define MBF_WRITE_MULTIPLE_REGISTERS            0x10
00046 #define MBF_READ_WRITE_MULTIPLE_REGISTERS       0x17
00047 #define MBF_MASK_WRITE_REGISTER                 0x16
00048 #define MBF_READ_FIFO_QUEUE                     0x18
00049 #define MBF_READ_FILE_RECORD                    0x14
00050 #define MBF_WRITE_FILE_RECORD                   0x15
00051 #define NBSF_FILE_RECORD                        0x06
00052 #define MBF_READ_EXCEPTION_STATUS               0x07    
00053 #define MBF_DIAGNOSTIC                          0x08    
00054 #define MBF_GET_COMM_EVENT_COUNTER              0x0B    
00055 #define MBF_GET_COMM_EVENT_LOG                  0x0C    
00056 #define MBF_REPORT_SLAVE_ID                     0x11    
00057 #define MBF_READ_DEVICE_IDENTIFICATION          0x2B
00058 #define MBF_HAS_EXCEPTION                       0x80
00059 #define MBF_MASK                                0x7F    
00060 
00061 
00062 #define MB_ERROR_FREE                           0       
00063 #define MB_OK                                   0       
00064 #define MB_ERROR_FORMAT                         -1
00065 #define MB_ERROR_LENGTH                         -2      
00066 #define MB_ERROR_PARAMETER                      -3      
00067 #define MB_ERROR_OPEN                           -4      
00068 #define MB_ERROR_TCP_NOT_CONNECTED              -5      
00069 #define MB_ERROR_NOT_OPENED                     -6      
00070 #define MB_ERROR_BUFFER_TOO_SHORT               -7
00071 #define MB_ERROR_NO_FRAME                       -8
00072 #define MB_ERROR_TIMEOUT                        -9
00073 #define MB_ERROR_EXECPTION                      -10
00074 #define MB_ERROR_BAD_FD                         -11
00075 #define MB_ERROR_NET                            -12
00076 #define MB_ERROR_NO_FILE_HANDLE                 -13
00077 #define MB_ERROR_PROTOCOL                       -14     
00078 #define MB_ERROR_FUNCTION                       -15
00079 #define MB_ERROR_MODE                           -16
00080 
00081 #endif
00082 

Generated on Thu Oct 6 09:13:41 2005 for Example Modbus Library by  doxygen 1.4.4