亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mb.h

?? 此為modbus/rtu 通信 ,在atmega128上調試通過,本人想做modbus/tcp的,多多交流
?? H
?? 第 1 頁 / 共 2 頁
字號:
/* 
 * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
 * Copyright (c) 2006 Christian Walter <wolti@sil.at>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * File: $Id: mb.h,v 1.17 2006/12/07 22:10:34 wolti Exp $
 */

#ifndef _MB_H
#define _MB_H

#include "port.h"

#ifdef __cplusplus
PR_BEGIN_EXTERN_C
#endif

#include "mbport.h"
#include "mbproto.h"

/*! \defgroup modbus Modbus
 * \code #include "mb.h" \endcode
 *
 * This module defines the interface for the application. It contains
 * the basic functions and types required to use the Modbus protocol stack.
 * A typical application will want to call eMBInit() first. If the device
 * is ready to answer network requests it must then call eMBEnable() to activate
 * the protocol stack. In the main loop the function eMBPoll() must be called
 * periodically. The time interval between pooling depends on the configured
 * Modbus timeout. If an RTOS is available a separate task should be created
 * and the task should always call the function eMBPoll().
 *
 * \code
 * // Initialize protocol stack in RTU mode for a slave with address 10 = 0x0A
 * eMBInit( MB_RTU, 0x0A, 38400, MB_PAR_EVEN );
 * // Enable the Modbus Protocol Stack.
 * eMBEnable(  );
 * for( ;; )
 * {
 *     // Call the main polling loop of the Modbus protocol stack.
 *     eMBPoll(  );
 *     ...
 * }
 * \endcode
 */

/* ----------------------- Defines ------------------------------------------*/

/*! \ingroup modbus
 * \brief Use the default Modbus TCP port (502)
 */
#define MB_TCP_PORT_USE_DEFAULT 0   

/* ----------------------- Type definitions ---------------------------------*/

/*! \ingroup modbus
 * \brief Modbus serial transmission modes (RTU/ASCII).
 *
 * Modbus serial supports two transmission modes. Either ASCII or RTU. RTU
 * is faster but has more hardware requirements and requires a network with
 * a low jitter. ASCII is slower and more reliable on slower links (E.g. modems)
 */
    typedef enum
{
    MB_RTU,                     /*!< RTU transmission mode. */
    MB_ASCII,                   /*!< ASCII transmission mode. */
    MB_TCP                      /*!< TCP mode. */
} eMBMode;

/*! \ingroup modbus
 * \brief If register should be written or read.
 *
 * This value is passed to the callback functions which support either
 * reading or writing register values. Writing means that the application
 * registers should be updated and reading means that the modbus protocol
 * stack needs to know the current register values.
 *
 * \see eMBRegHoldingCB( ), eMBRegCoilsCB( ), eMBRegDiscreteCB( ) and 
 *   eMBRegInputCB( ).
 */
typedef enum
{
    MB_REG_READ,                /*!< Read register values and pass to protocol stack. */
    MB_REG_WRITE                /*!< Update register values. */
} eMBRegisterMode;

/*! \ingroup modbus
 * \brief Errorcodes used by all function in the protocol stack.
 */
typedef enum
{
    MB_ENOERR,                  /*!< no error. */
    MB_ENOREG,                  /*!< illegal register address. */
    MB_EINVAL,                  /*!< illegal argument. */
    MB_EPORTERR,                /*!< porting layer error. */
    MB_ENORES,                  /*!< insufficient resources. */
    MB_EIO,                     /*!< I/O error. */
    MB_EILLSTATE,               /*!< protocol stack in illegal state. */
    MB_ETIMEDOUT                /*!< timeout error occurred. */
} eMBErrorCode;


/* ----------------------- Function prototypes ------------------------------*/
/*! \ingroup modbus
 * \brief Initialize the Modbus protocol stack.
 *
 * This functions initializes the ASCII or RTU module and calls the
 * init functions of the porting layer to prepare the hardware. Please
 * note that the receiver is still disabled and no Modbus frames are
 * processed until eMBEnable( ) has been called.
 *
 * \param eMode If ASCII or RTU mode should be used.
 * \param ucSlaveAddress The slave address. Only frames sent to this
 *   address or to the broadcast address are processed.
 * \param ucPort The port to use. E.g. 1 for COM1 on windows. This value
 *   is platform dependent and some ports simply choose to ignore it.
 * \param ulBaudRate The baudrate. E.g. 19200. Supported baudrates depend
 *   on the porting layer.
 * \param eParity Parity used for serial transmission.
 *
 * \return If no error occurs the function returns eMBErrorCode::MB_ENOERR.
 *   The protocol is then in the disabled state and ready for activation
 *   by calling eMBEnable( ). Otherwise one of the following error codes 
 *   is returned:
 *    - eMBErrorCode::MB_EINVAL If the slave address was not valid. Valid
 *        slave addresses are in the range 1 - 247.
 *    - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error.
 */
eMBErrorCode    eMBInit( eMBMode eMode, UCHAR ucSlaveAddress,
                         UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity );

/*! \ingroup modbus
 * \brief Initialize the Modbus protocol stack for Modbus TCP.
 *
 * This function initializes the Modbus TCP Module. Please note that
 * frame processing is still disabled until eMBEnable( ) is called.
 *
 * \param usTCPPort The TCP port to listen on.
 * \return If the protocol stack has been initialized correctly the function
 *   returns eMBErrorCode::MB_ENOERR. Otherwise one of the following error
 *   codes is returned:
 *    - eMBErrorCode::MB_EINVAL If the slave address was not valid. Valid
 *        slave addresses are in the range 1 - 247.
 *    - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error.
 */
eMBErrorCode    eMBTCPInit( USHORT usTCPPort );

/*! \ingroup modbus
 * \brief Release resources used by the protocol stack.
 *
 * This function disables the Modbus protocol stack and release all
 * hardware resources. It must only be called when the protocol stack 
 * is disabled. 
 *
 * \note Note all ports implement this function. A port which wants to 
 *   get an callback must define the macro MB_PORT_HAS_CLOSE to 1.
 *
 * \return If the resources where released it return eMBErrorCode::MB_ENOERR.
 *   If the protocol stack is not in the disabled state it returns
 *   eMBErrorCode::MB_EILLSTATE.
 */
eMBErrorCode    eMBClose( void );

/*! \ingroup modbus
 * \brief Enable the Modbus protocol stack.
 *
 * This function enables processing of Modbus frames. Enabling the protocol
 * stack is only possible if it is in the disabled state.
 *
 * \return If the protocol stack is now in the state enabled it returns 
 *   eMBErrorCode::MB_ENOERR. If it was not in the disabled state it 
 *   return eMBErrorCode::MB_EILLSTATE.
 */
eMBErrorCode    eMBEnable( void );

/*! \ingroup modbus
 * \brief Disable the Modbus protocol stack.
 *
 * This function disables processing of Modbus frames.
 *
 * \return If the protocol stack has been disabled it returns 
 *  eMBErrorCode::MB_ENOERR. If it was not in the enabled state it returns
 *  eMBErrorCode::MB_EILLSTATE.
 */
eMBErrorCode    eMBDisable( void );

/*! \ingroup modbus

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精一区二区三区| 久久众筹精品私拍模特| 7777精品伊人久久久大香线蕉的| 日韩三级.com| 国产日本亚洲高清| 亚洲综合色在线| 国产精品资源在线看| 在线观看中文字幕不卡| 欧美成人女星排行榜| 日韩理论片在线| 蜜臀av一区二区| youjizz久久| 日韩欧美中文字幕制服| 国产精品久久久久久久久快鸭| 国模套图日韩精品一区二区 | 欧美亚洲自拍偷拍| 精品精品国产高清一毛片一天堂| 中文字幕在线一区免费| 日韩福利视频导航| 成年人国产精品| 日韩一级高清毛片| 亚洲精品中文字幕乱码三区| 老司机精品视频在线| 91蜜桃在线免费视频| 精品久久久久久综合日本欧美| 国产精品夫妻自拍| 免费人成在线不卡| 精品制服美女久久| 日本一区二区三区四区| 久久精品亚洲国产奇米99| 色94色欧美sute亚洲线路二| av电影天堂一区二区在线观看| 中文字幕av不卡| 国产一区二区福利| 精品国产一区二区精华| 国产一区二区三区四区五区美女| 欧美一区二区三区视频免费播放| 亚洲综合自拍偷拍| 成人免费观看男女羞羞视频| 欧美撒尿777hd撒尿| 国产精品人成在线观看免费 | 亚洲丝袜自拍清纯另类| 成人av网在线| 亚洲激情自拍偷拍| 99riav久久精品riav| 一区二区三区四区中文字幕| 色婷婷精品大视频在线蜜桃视频| 亚洲色图制服诱惑| 欧美亚洲国产一区二区三区va| 欧美aaaaa成人免费观看视频| 欧美在线影院一区二区| 亚洲乱码国产乱码精品精98午夜| 久久精品国产久精国产| 午夜精品123| 亚洲美女免费在线| 成人午夜av在线| 久久综合给合久久狠狠狠97色69| 日韩va亚洲va欧美va久久| 欧美午夜电影在线播放| 亚洲精品中文在线影院| 99久久精品国产毛片| 欧美极品aⅴ影院| 国产美女在线观看一区| 亚洲精品在线网站| 老司机午夜精品99久久| 日韩欧美一级在线播放| 日本午夜精品一区二区三区电影| 欧美日韩国产色站一区二区三区| 亚洲精品高清在线| 色综合一个色综合亚洲| 亚洲欧美激情小说另类| 91蜜桃免费观看视频| 欧美国产乱子伦| 国产精品综合久久| 中文字幕巨乱亚洲| 粗大黑人巨茎大战欧美成人| 欧美性生活一区| 欧美日韩国产首页在线观看| 久久欧美中文字幕| 国产一区视频网站| 国产喂奶挤奶一区二区三区| 久久一夜天堂av一区二区三区| 久久影院电视剧免费观看| 韩国v欧美v日本v亚洲v| 欧美一区二区视频在线观看2022| 天天亚洲美女在线视频| 欧美一级国产精品| 激情欧美一区二区三区在线观看| 精品免费国产一区二区三区四区| 免费成人在线观看| 久久女同互慰一区二区三区| 成人在线综合网| 亚洲精品成人精品456| 欧美日韩精品一二三区| 麻豆国产精品一区二区三区| 国产午夜精品美女毛片视频| 成人一区二区三区视频| 亚洲精品免费在线播放| 欧美精品在线视频| 青青草精品视频| 日本一区二区三区久久久久久久久不| av一区二区三区| 亚洲高清不卡在线观看| 精品国产青草久久久久福利| 成人91在线观看| 天天亚洲美女在线视频| 久久夜色精品国产欧美乱极品| caoporen国产精品视频| 亚洲va国产va欧美va观看| 精品福利一区二区三区免费视频| 粉嫩在线一区二区三区视频| 亚洲一区二区欧美日韩| 日韩亚洲电影在线| 99天天综合性| 日韩中文字幕1| 久久久久99精品一区| 一本大道av一区二区在线播放| 日本不卡一区二区三区高清视频| 国产亚洲精品aa| 欧美人妖巨大在线| 成人精品小蝌蚪| 日韩高清欧美激情| 国产精品久久久久毛片软件| 在线成人小视频| 成人福利视频在线看| 日韩av不卡在线观看| 国产精品青草久久| 欧美一级电影网站| 色婷婷综合久久| 国产麻豆精品久久一二三| 亚洲国产人成综合网站| 国产精品入口麻豆九色| 欧美一区2区视频在线观看| aa级大片欧美| 国产呦萝稀缺另类资源| 午夜伦欧美伦电影理论片| 亚洲欧洲精品天堂一级| 欧美成人一级视频| 欧美在线free| 成人美女视频在线观看| 麻豆国产一区二区| 亚洲电影激情视频网站| 一区视频在线播放| 久久日一线二线三线suv| 欧美日韩一区三区| 99久精品国产| 国产毛片一区二区| 美女性感视频久久| 亚洲综合图片区| 中文字幕一区二区三区视频| 国产亚洲一区二区三区在线观看| 4438x亚洲最大成人网| 色香色香欲天天天影视综合网| 黄色资源网久久资源365| 日韩电影免费一区| 一区二区激情小说| 亚洲欧洲av另类| 国产性做久久久久久| 日韩视频免费直播| 欧美群妇大交群中文字幕| 日本乱人伦aⅴ精品| 91丨九色丨国产丨porny| 成人午夜精品在线| 国产精品一区专区| 国产麻豆视频精品| 国产一区二区不卡| 韩日精品视频一区| 加勒比av一区二区| 久久国产尿小便嘘嘘| 免费成人在线视频观看| 日韩电影网1区2区| 日韩av一级电影| 日本欧美一区二区三区| 日韩精品一二区| 免费观看30秒视频久久| 免费在线欧美视频| 蜜臀精品一区二区三区在线观看 | 国产精品一区二区不卡| 精品一区二区国语对白| 久久激情综合网| 秋霞影院一区二区| 日韩黄色在线观看| 日韩高清在线电影| 蜜桃av一区二区三区| 青青草国产精品97视觉盛宴| 青娱乐精品在线视频| 美女视频黄a大片欧美| 久久精品国产在热久久| 久久99国产精品尤物| 国产成人综合自拍| 成人动漫精品一区二区| 91丨九色丨尤物| 欧美视频一区在线| 欧美电影在线免费观看| 欧美va亚洲va在线观看蝴蝶网| 久久亚洲一区二区三区四区| 国产日产欧美一区二区视频| 最新高清无码专区| 亚洲一区二区三区三| 奇米影视一区二区三区|