Loading...
Searching...
No Matches
API for Master Requests
Modbus tools » Main API for Modbus Library

API для формирования фрейма-запроса в режиме мастер More...

Collaboration diagram for API for Master Requests:

## Topics

| API for Registers
| API для чтения регистров из ответа в режиме мастер
| API for Coils
| API для чтения coils из ответа в режиме мастер
| API for Device Identifications
| API для чтения идентификторов из ответа в режиме мастер
| API for Diagnostics
| API для чтения диагностической информации из ответа в режиме мастер

## Functions

RS_MsgTypeDef | MB_REQUEST_READ_COILS (uint8_t slave_addr, uint16_t start_addr, uint16_t quantity)
| Сформировать запрос на чтение коилов
RS_MsgTypeDef | MB_REQUEST_READ_DISCRETE_INPUTS (uint8_t slave_addr, uint16_t start_addr, uint16_t quantity)
| Сформировать запрос на чтение дискретных регистров
RS_MsgTypeDef | MB_REQUEST_READ_HOLDING_REGS (uint8_t slave_addr, uint16_t start_addr, uint16_t quantity)
| Сформировать запрос на чтение холдинг регистров
RS_MsgTypeDef | MB_REQUEST_READ_INPUT_REGS (uint8_t slave_addr, uint16_t start_addr, uint16_t quantity)
| Сформировать запрос на чтение инпут регистров
RS_MsgTypeDef | MB_REQUEST_WRITE_SINGLE_COIL (uint8_t slave_addr, uint16_t coil_addr, uint8_t value)
| Сформировать запрос на запись одного коила
RS_MsgTypeDef | MB_REQUEST_WRITE_SINGLE_REG (uint8_t slave_addr, uint16_t reg_addr, uint16_t value)
| Сформировать запрос на запись одного регистра
RS_MsgTypeDef | MB_REQUEST_WRITE_MULTIPLE_COILS (uint8_t slave_addr, uint16_t start_addr, uint16_t quantity, uint8_t *coils_data)
| Сформировать запрос на запись нескольких регистров
RS_MsgTypeDef | MB_REQUEST_WRITE_MULTIPLE_REGS (uint8_t slave_addr, uint16_t start_addr, uint16_t quantity, uint16_t *regs_data)
| Сформировать запрос на запись нескольких коилов
RS_MsgTypeDef | MB_REQUEST_DIAGNOSTIC_QUERY (uint8_t slave_addr, uint16_t sub_function, uint16_t data)
RS_MsgTypeDef | MB_REQUEST_RETURN_QUERY_DATA (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_RESTART_COMMUNICATIONS (uint8_t slave_addr, uint16_t data)
RS_MsgTypeDef | MB_REQUEST_RETURN_DIAGNOSTIC_REGISTER (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_FORCE_LISTEN_ONLY_MODE (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_CLEAR_COUNTERS_AND_DIAGNOSTIC_REGISTER (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_RETURN_BUS_MESSAGE_COUNT (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_RETURN_BUS_COMMUNICATION_ERROR_COUNT (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_RETURN_SLAVE_EXCEPTION_ERROR_COUNT (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_RETURN_SLAVE_MESSAGE_COUNT (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_RETURN_SLAVE_NO_RESPONSE_COUNT (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_RETURN_SLAVE_NAK_COUNT (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_RETURN_SLAVE_BUSY_COUNT (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_RETURN_BUS_CHARACTER_OVERRUN_COUNT (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_READ_DEVICE_ID_BASIC (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_READ_DEVICE_ID_REGULAR (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_READ_DEVICE_ID_EXTENDED (uint8_t slave_addr)
RS_MsgTypeDef | MB_REQUEST_READ_DEVICE_ID_SPECIFIC (uint8_t slave_addr, uint8_t object_id)

## Detailed Description

API для формирования фрейма-запроса в режиме мастер

Примеры использования:

// Чтение 10 holding registers начиная с адреса 0
RS_MsgTypeDef read_msg = MB_REQUEST_READ_HOLDING_REGS(1, 0, 10);
// Запись одного coil
RS_MsgTypeDef write_coil_msg = MB_REQUEST_WRITE_SINGLE_COIL(1, 5, 1);
// Диагностический запрос
RS_MsgTypeDef diag_msg = MB_REQUEST_RETURN_BUS_MESSAGE_COUNT(1);
// Идентификация устройства
RS_MsgTypeDef dev_id_msg = MB_REQUEST_READ_DEVICE_ID_BASIC(1);
MB_REQUEST_WRITE_SINGLE_COIL
RS_MsgTypeDef MB_REQUEST_WRITE_SINGLE_COIL(uint8_t slave_addr, uint16_t coil_addr, uint8_t value)
Сформировать запрос на запись одного коила
Definition modbus_master.c:612
MB_REQUEST_READ_HOLDING_REGS
RS_MsgTypeDef MB_REQUEST_READ_HOLDING_REGS(uint8_t slave_addr, uint16_t start_addr, uint16_t quantity)
Сформировать запрос на чтение холдинг регистров
Definition modbus_master.c:598
RS_MsgTypeDef
Structure for modbus messsage.
Definition modbus_core.h:177

## Function Documentation

## MB_REQUEST_READ_COILS()

RS_MsgTypeDef MB_REQUEST_READ_COILS | ( | uint8_t | slave_addr,
|  | uint16_t | start_addr,
|  | uint16_t | quantity )

Сформировать запрос на чтение коилов

Definition at line 584 of file modbus_master.c.

## MB_REQUEST_READ_DISCRETE_INPUTS()

RS_MsgTypeDef MB_REQUEST_READ_DISCRETE_INPUTS | ( | uint8_t | slave_addr,
|  | uint16_t | start_addr,
|  | uint16_t | quantity )

Сформировать запрос на чтение дискретных регистров

Definition at line 591 of file modbus_master.c.

## MB_REQUEST_READ_HOLDING_REGS()

RS_MsgTypeDef MB_REQUEST_READ_HOLDING_REGS | ( | uint8_t | slave_addr,
|  | uint16_t | start_addr,
|  | uint16_t | quantity )

Сформировать запрос на чтение холдинг регистров

Definition at line 598 of file modbus_master.c.

## MB_REQUEST_READ_INPUT_REGS()

RS_MsgTypeDef MB_REQUEST_READ_INPUT_REGS | ( | uint8_t | slave_addr,
|  | uint16_t | start_addr,
|  | uint16_t | quantity )

Сформировать запрос на чтение инпут регистров

Definition at line 605 of file modbus_master.c.

## MB_REQUEST_WRITE_SINGLE_COIL()

RS_MsgTypeDef MB_REQUEST_WRITE_SINGLE_COIL | ( | uint8_t | slave_addr,
|  | uint16_t | coil_addr,
|  | uint8_t | value )

Сформировать запрос на запись одного коила

Definition at line 612 of file modbus_master.c.

## MB_REQUEST_WRITE_SINGLE_REG()

RS_MsgTypeDef MB_REQUEST_WRITE_SINGLE_REG | ( | uint8_t | slave_addr,
|  | uint16_t | reg_addr,
|  | uint16_t | value )

Сформировать запрос на запись одного регистра

Definition at line 619 of file modbus_master.c.

## MB_REQUEST_WRITE_MULTIPLE_COILS()

RS_MsgTypeDef MB_REQUEST_WRITE_MULTIPLE_COILS | ( | uint8_t | slave_addr,
|  | uint16_t | start_addr,
|  | uint16_t | quantity,
|  | uint8_t * | coils_data )

Сформировать запрос на запись нескольких регистров

Definition at line 626 of file modbus_master.c.

## MB_REQUEST_WRITE_MULTIPLE_REGS()

RS_MsgTypeDef MB_REQUEST_WRITE_MULTIPLE_REGS | ( | uint8_t | slave_addr,
|  | uint16_t | start_addr,
|  | uint16_t | quantity,
|  | uint16_t * | regs_data )

Сформировать запрос на запись нескольких коилов

Definition at line 645 of file modbus_master.c.

## MB_REQUEST_DIAGNOSTIC_QUERY()

RS_MsgTypeDef MB_REQUEST_DIAGNOSTIC_QUERY | ( | uint8_t | slave_addr,
|  | uint16_t | sub_function,
|  | uint16_t | data )

Definition at line 660 of file modbus_master.c.

## MB_REQUEST_RETURN_QUERY_DATA()

RS_MsgTypeDef MB_REQUEST_RETURN_QUERY_DATA | ( | uint8_t | slave_addr | ) |

Definition at line 665 of file modbus_master.c.

## MB_REQUEST_RESTART_COMMUNICATIONS()

RS_MsgTypeDef MB_REQUEST_RESTART_COMMUNICATIONS | ( | uint8_t | slave_addr,
|  | uint16_t | data )

Definition at line 670 of file modbus_master.c.

## MB_REQUEST_RETURN_DIAGNOSTIC_REGISTER()

RS_MsgTypeDef MB_REQUEST_RETURN_DIAGNOSTIC_REGISTER | ( | uint8_t | slave_addr | ) |

Definition at line 675 of file modbus_master.c.

## MB_REQUEST_FORCE_LISTEN_ONLY_MODE()

RS_MsgTypeDef MB_REQUEST_FORCE_LISTEN_ONLY_MODE | ( | uint8_t | slave_addr | ) |

Definition at line 680 of file modbus_master.c.

## MB_REQUEST_CLEAR_COUNTERS_AND_DIAGNOSTIC_REGISTER()

RS_MsgTypeDef MB_REQUEST_CLEAR_COUNTERS_AND_DIAGNOSTIC_REGISTER | ( | uint8_t | slave_addr | ) |

Definition at line 685 of file modbus_master.c.

## MB_REQUEST_RETURN_BUS_MESSAGE_COUNT()

RS_MsgTypeDef MB_REQUEST_RETURN_BUS_MESSAGE_COUNT | ( | uint8_t | slave_addr | ) |

Definition at line 690 of file modbus_master.c.

## MB_REQUEST_RETURN_BUS_COMMUNICATION_ERROR_COUNT()

RS_MsgTypeDef MB_REQUEST_RETURN_BUS_COMMUNICATION_ERROR_COUNT | ( | uint8_t | slave_addr | ) |

Definition at line 695 of file modbus_master.c.

## MB_REQUEST_RETURN_SLAVE_EXCEPTION_ERROR_COUNT()

RS_MsgTypeDef MB_REQUEST_RETURN_SLAVE_EXCEPTION_ERROR_COUNT | ( | uint8_t | slave_addr | ) |

Definition at line 700 of file modbus_master.c.

## MB_REQUEST_RETURN_SLAVE_MESSAGE_COUNT()

RS_MsgTypeDef MB_REQUEST_RETURN_SLAVE_MESSAGE_COUNT | ( | uint8_t | slave_addr | ) |

Definition at line 705 of file modbus_master.c.

## MB_REQUEST_RETURN_SLAVE_NO_RESPONSE_COUNT()

RS_MsgTypeDef MB_REQUEST_RETURN_SLAVE_NO_RESPONSE_COUNT | ( | uint8_t | slave_addr | ) |

Definition at line 710 of file modbus_master.c.

## MB_REQUEST_RETURN_SLAVE_NAK_COUNT()

RS_MsgTypeDef MB_REQUEST_RETURN_SLAVE_NAK_COUNT | ( | uint8_t | slave_addr | ) |

Definition at line 715 of file modbus_master.c.

## MB_REQUEST_RETURN_SLAVE_BUSY_COUNT()

RS_MsgTypeDef MB_REQUEST_RETURN_SLAVE_BUSY_COUNT | ( | uint8_t | slave_addr | ) |

Definition at line 720 of file modbus_master.c.

## MB_REQUEST_RETURN_BUS_CHARACTER_OVERRUN_COUNT()

RS_MsgTypeDef MB_REQUEST_RETURN_BUS_CHARACTER_OVERRUN_COUNT | ( | uint8_t | slave_addr | ) |

Definition at line 725 of file modbus_master.c.

## MB_REQUEST_READ_DEVICE_ID_BASIC()

RS_MsgTypeDef MB_REQUEST_READ_DEVICE_ID_BASIC | ( | uint8_t | slave_addr | ) |

Definition at line 731 of file modbus_master.c.

## MB_REQUEST_READ_DEVICE_ID_REGULAR()

RS_MsgTypeDef MB_REQUEST_READ_DEVICE_ID_REGULAR | ( | uint8_t | slave_addr | ) |

Definition at line 737 of file modbus_master.c.

## MB_REQUEST_READ_DEVICE_ID_EXTENDED()

RS_MsgTypeDef MB_REQUEST_READ_DEVICE_ID_EXTENDED | ( | uint8_t | slave_addr | ) |

Definition at line 743 of file modbus_master.c.

## MB_REQUEST_READ_DEVICE_ID_SPECIFIC()

RS_MsgTypeDef MB_REQUEST_READ_DEVICE_ID_SPECIFIC | ( | uint8_t | slave_addr,
|  | uint8_t | object_id )

Definition at line 749 of file modbus_master.c.