mbconfig.h
上传用户:kongshuqi
上传日期:2013-10-09
资源大小:59k
文件大小:4k
源码类别:

通讯编程

开发平台:

Visual C++

  1.  /*
  2.   * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
  3.   * Copyright (C) 2006 Christian Walter <wolti@sil.at>
  4.   *
  5.   * This library is free software; you can redistribute it and/or
  6.   * modify it under the terms of the GNU Lesser General Public
  7.   * License as published by the Free Software Foundation; either
  8.   * version 2.1 of the License, or (at your option) any later version.
  9.   *
  10.   * This library is distributed in the hope that it will be useful,
  11.   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.   * Lesser General Public License for more details.
  14.   *
  15.   * You should have received a copy of the GNU Lesser General Public
  16.   * License along with this library; if not, write to the Free Software
  17.   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  18.   *
  19.   * File: $Id: mbconfig.h,v 1.12 2006/06/26 18:52:49 wolti Exp $
  20.   */
  21. #ifndef _MB_CONFIG_H
  22. #define _MB_CONFIG_H
  23. #ifdef __cplusplus
  24. PR_BEGIN_EXTERN_C
  25. #endif
  26. /* ----------------------- Defines ------------------------------------------*/
  27. /*! defgroup modbus_cfg Modbus Configuration
  28.  *
  29.  * Most modules in the protocol stack are completly optional and can be
  30.  * excluded. This is specially important if target resources are very small
  31.  * and program memory space should be saved.<br>
  32.  *
  33.  * All of these settings are available in the file <code>mbconfig.h</code>
  34.  */
  35. /*! addtogroup modbus_cfg
  36.  *  @{
  37.  */
  38. /*! brief If Modbus ASCII support is enabled. */
  39. #define MB_ASCII_ENABLED                        (  1 )
  40. /*! brief If Modbus RTU support is enabled. */
  41. #define MB_RTU_ENABLED                          (  1 )
  42. /*! brief If Modbus TCP support is enabled. */
  43. #define MB_TCP_ENABLED                          (  0 )
  44. /*! brief The character timeout value for Modbus ASCII.
  45.  *
  46.  * The character timeout value is not fixed for Modbus ASCII and is therefore
  47.  * a configuration option. It should be set to the maximum expected delay
  48.  * time of the network.
  49.  */
  50. #define MB_ASCII_TIMEOUT_SEC                    (  1 )
  51. /*! brief Maximum number of Modbus functions codes the protocol stack
  52.  *    should support.
  53.  *
  54.  * The maximum number of supported Modbus functions must be greater than
  55.  * the sum of all enabled functions in this file and custom function
  56.  * handlers. If set to small adding more functions will fail.
  57.  */
  58. #define MB_FUNC_HANDLERS_MAX                    ( 16 )
  59. /*! brief Number of bytes which should be allocated for the <em>Report Slave ID
  60.  *    </em>command.
  61.  *
  62.  * This number limits the maximum size of the additional segment in the
  63.  * report slave id function. See eMBSetSlaveID(  ) for more information on
  64.  * how to set this value. It is only used if MB_FUNC_OTHER_REP_SLAVEID_ENABLED
  65.  * is set to <code>1</code>.
  66.  */
  67. #define MB_FUNC_OTHER_REP_SLAVEID_BUF           ( 32 )
  68. /*! brief If the <em>Report Slave ID</em> function should be enabled. */
  69. #define MB_FUNC_OTHER_REP_SLAVEID_ENABLED       (  1 )
  70. /*! brief If the <em>Read Input Registers</em> function should be enabled. */
  71. #define MB_FUNC_READ_INPUT_ENABLED              (  1 )
  72. /*! brief If the <em>Read Holding Registers</em> function should be enabled. */
  73. #define MB_FUNC_READ_HOLDING_ENABLED            (  1 )
  74. /*! brief If the <em>Write Single Register</em> function should be enabled. */
  75. #define MB_FUNC_WRITE_HOLDING_ENABLED           (  1 )
  76. /*! brief If the <em>Write Multiple registers</em> function should be enabled. */
  77. #define MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED  (  1 )
  78. /*! brief If the <em>Read Coils</em> function should be enabled. */
  79. #define MB_FUNC_READ_COILS_ENABLED              (  1 )
  80. /*! brief If the <em>Write Coils</em> function should be enabled. */
  81. #define MB_FUNC_WRITE_COIL_ENABLED              (  1 )
  82. /*! brief If the <em>Write Multiple Coils</em> function should be enabled. */
  83. #define MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED    (  1 )
  84. /*! brief If the <em>Read Discrete Inputs</em> function should be enabled. */
  85. #define MB_FUNC_READ_DISCRETE_INPUTS_ENABLED    (  1 )
  86. /*! @} */
  87. #ifdef __cplusplus
  88.     PR_END_EXTERN_C
  89. #endif
  90. #endif