⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mb_mst.h

📁 modbus的c语言版本应用于dos下
💻 H
字号:
/******************************************************************************
*
* (c) 2004 by BECK IPC GmbH
*
*******************************************************************************
*
* Disclaimer: This program is an example and should be used as such.
*             If you wish to use this program or parts of it in your application,
*             you must validate the code yourself. BECK IPC GmbH can not be held
*             responsible for the correct functioning or coding of this example.
*
* Module:     mb_ser_c.h
* Function:   modbus serial functions
*
*******************************************************************************
*
* $Header: mb_mst.h, 2, 05.09.2005 10:24:03, Andre Pribil$
*
******************************************************************************/
#ifndef __MB_SER_H__
#define __MB_SER_H__
//******************************************************************************/

/******************************************************************************
* Constant defines
******************************************************************************/
#define SEND_QUEUE_TIMEOUT       50
#define MB_RS485                  2
#define MB_RS232_NONE             1
#define MB_RS232_HWFLOW           0

//******************************************************************************
// Function prototypes: descritption see at mb_ser_c.c
//******************************************************************************
int mb_ser_init(int port,
                long baud,
                int parity,
                unsigned char serial_mode);
//******************************************************************************
void mb_ser_deinit(int port);
//******************************************************************************
int mb_ser_req_wr_holding_regs( unsigned char  slave_addr,
                                unsigned int   start_address,
                                unsigned int   items,
                                unsigned int  * register_data,
                                unsigned char * exception,
                                unsigned int timeout
                              );
//******************************************************************************
int mb_ser_req_wr_single_reg ( unsigned char  slave_addr,
                               unsigned int   start_address,
                               unsigned int   register_data,
                               unsigned char * exception,
                               unsigned int timeout
                             );
//******************************************************************************
int mb_ser_req_wr_single_coil ( unsigned char  slave_addr,
                                unsigned int   start_address,
                                unsigned char  coil,  //0 OFF, else ON
                                unsigned char * exception,
                                unsigned int timeout
                              );
//******************************************************************************
int mb_ser_req_rd_coils( unsigned char  slave_addr,
                         unsigned char function_code, //01 or 02
                         unsigned int  start_address,
                         unsigned int  quantity,
                         unsigned char * coils,
                         unsigned char * exception,
                         unsigned int timeout
                        );
//******************************************************************************
int mb_ser_req_wr_coils( unsigned char  slave_addr,
                         unsigned int  start_address,
                         unsigned int  quantity,
                         unsigned char * coils,
                         unsigned char * exception,
                         unsigned int timeout
                        );
//******************************************************************************
int mb_ser_req_rd_regs( unsigned char  slave_addr,
                        unsigned char  function_code,
                        unsigned int   start_address,
                        unsigned int   quantity,
                        unsigned int  * register_data,
                        unsigned char * exception,
                        unsigned int timeout
                      );
//******************************************************************************                      
int mb_ser_req_dev_id ( unsigned char  slave_addr,
                        unsigned char  id_code,
                        unsigned char  obj_id,
                        unsigned char  *more,
                        unsigned char  *next_id,
                        unsigned char  *how_many,
                        unsigned char  *obj_data[],
                        unsigned int   max_single_obj_length,
                        unsigned char  *exception,
                        unsigned int timeout
                      );

//******************************************************************************
#endif  //__MB_SER_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -