| ioPAC RTU Controllers C/C++ Sample Code Programming Guide

- Main Page
- Modules
- Data Structures
- Files

Modules | Macros | Enumerations | Functions
ModbusMaster
Library

## Modules
| ModbusRTUMaster
| ModbusTCPMaster

## Macros
#define | MODBUS_EXCEPTION_CODE_NONE 0x00
#define | MODBUS_EXCEPTION_CODE_ILLEGAL_FUNCTION 0x01
#define | MODBUS_EXCEPTION_CODE_ILLEGAL_DATA_ADDRESS 0x02
#define | MODBUS_EXCEPTION_CODE_ILLEGAL_DATA_VALUE 0x03
#define | MODBUS_EXCEPTION_CODE_SLAVE_DEVICE_FAILURE 0x04
#define | MODBUS_EXCEPTION_CODE_ACKNOWLEDGE 0x05
#define | MODBUS_EXCEPTION_CODE_SLAVE_DEVICE_BUSY 0x06
#define | MODBUS_EXCEPTION_CODE_MEMORY_PARITY_ERROR 0x08
#define | MODBUS_EXCEPTION_CODE_GATEWAY_PATH_UNAVAILABLE 0x0A
#define | MODBUS_EXCEPTION_CODE_GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND 0x0B

## Enumerations
enum | MODBUS_MASTER_ERR_CODE { MODBUS_MASTER_ERR_OK = 0, MODBUS_MASTER_ERR_PARAM, MODBUS_MASTER_ERR_PORT, MODBUS_MASTER_ERR_OPENED, MODBUS_MASTER_ERR_NOT_OPENED, MODBUS_MASTER_ERR_UART_OPEN, MODBUS_MASTER_ERR_UART_CLOSE, MODBUS_MASTER_ERR_UART_BAUDRATE, MODBUS_MASTER_ERR_UART_MODE, MODBUS_MASTER_ERR_UART_FORMAT, MODBUS_MASTER_ERR_UART_FLOW, MODBUS_MASTER_ERR_UART_WRITE, MODBUS_MASTER_ERR_RESP, MODBUS_MASTER_ERR_CRC, MODBUS_MASTER_ERR_TIMEOUT, MODBUS_MASTER_ERR_SOCKET, MODBUS_MASTER_ERR_CONNECT, MODBUS_MASTER_ERR_HANDLE, MODBUS_MASTER_ERR_EXCEPTION, MODBUS_MASTER_ERR_LIB_INIT, MODBUS_MASTER_ERR_SYSTEM_INFO, MODBUS_MASTER_ERR_HOT_PLUG, MODBUS_MASTER_ERR_KEEPALIVE, MODBUS_MASTER_ERR_AMOUNT }

## Functions
MODBUS_MASTER_ERR_CODE | MX_RTU_Modbus_Master_Init (void)
| This API must be called at first. More...
void | MX_RTU_Modbus_Master_Uninit (void)
| This API must be called at the end. More...

## Detailed Description

Sample Code:

- modbus_rtu_master.c
- modbus_tcp_master.c

## Macro Definition Documentation

#define MODBUS_EXCEPTION_CODE_NONE 0x00

#define MODBUS_EXCEPTION_CODE_ILLEGAL_FUNCTION 0x01

#define MODBUS_EXCEPTION_CODE_ILLEGAL_DATA_ADDRESS 0x02

#define MODBUS_EXCEPTION_CODE_ILLEGAL_DATA_VALUE 0x03

#define MODBUS_EXCEPTION_CODE_SLAVE_DEVICE_FAILURE 0x04

#define MODBUS_EXCEPTION_CODE_ACKNOWLEDGE 0x05

#define MODBUS_EXCEPTION_CODE_SLAVE_DEVICE_BUSY 0x06

#define MODBUS_EXCEPTION_CODE_MEMORY_PARITY_ERROR 0x08

#define MODBUS_EXCEPTION_CODE_GATEWAY_PATH_UNAVAILABLE 0x0A

#define MODBUS_EXCEPTION_CODE_GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND 0x0B

## Enumeration Type Documentation

enum MODBUS_MASTER_ERR_CODE

Enumerator
MODBUS_MASTER_ERR_OK | 0
MODBUS_MASTER_ERR_PARAM | 1
MODBUS_MASTER_ERR_PORT | 2
MODBUS_MASTER_ERR_OPENED | 3
MODBUS_MASTER_ERR_NOT_OPENED | 4
MODBUS_MASTER_ERR_UART_OPEN | 5
MODBUS_MASTER_ERR_UART_CLOSE | 6
MODBUS_MASTER_ERR_UART_BAUDRATE | 7
MODBUS_MASTER_ERR_UART_MODE | 8
MODBUS_MASTER_ERR_UART_FORMAT | 9
MODBUS_MASTER_ERR_UART_FLOW | 10
MODBUS_MASTER_ERR_UART_WRITE | 11
MODBUS_MASTER_ERR_RESP | 12
MODBUS_MASTER_ERR_CRC | 13
MODBUS_MASTER_ERR_TIMEOUT | 14
MODBUS_MASTER_ERR_SOCKET | 15
MODBUS_MASTER_ERR_CONNECT | 16
MODBUS_MASTER_ERR_HANDLE | 17
MODBUS_MASTER_ERR_EXCEPTION | 18
MODBUS_MASTER_ERR_LIB_INIT | 19
MODBUS_MASTER_ERR_SYSTEM_INFO | 20
MODBUS_MASTER_ERR_HOT_PLUG | 21
MODBUS_MASTER_ERR_KEEPALIVE | 22
MODBUS_MASTER_ERR_AMOUNT | 23

## Function Documentation

MODBUS_MASTER_ERR_CODE MX_RTU_Modbus_Master_Init | ( | void |  | ) |

This API must be called at first.

Returns
  MODBUS_MASTER_ERR_CODE

void MX_RTU_Modbus_Master_Uninit | ( | void |  | ) |

This API must be called at the end.