====== ImodbusRTUmasterRun() ====== ''ImodbusRTUmasterRun()'' executes a registered request or the specified single request. {{:en-us_commands:reference:imodbusrtumasterrun.svg?900|ImodbusRTUmasterRun command operation flow}} ''uint8_t ImodbusRTUmasterRun()''\\ ''uint8_t ImodbusRTUmasterRun(HardwareSerial& serialPort, uint8_t slaveId, uint8_t functionCode, uint16_t address, uint16_t quantity, uint16_t* data, uint16_t timeoutMs = 100)'' ===== Commands ===== ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ''ImodbusRTUmasterRun()'' | None | ''uint8_t'' | Executes a registered request or the specified single request. | ===== Example ===== void setup() { ImodbusRTUmasterInit(Serial2, 9600); // Set the Master's communication port and baud rate. ImodbusRTUmasterAdd(Serial2, 1, 0x03, 0x00, 1, &D[1]); // Register a Master request for repeated execution. ImodbusRTUmasterAdd(Serial2, 1, 0x03, 0x01, 1, &D[2]); // Register a Master request for repeated execution. } void loop() { ImodbusRTUmasterRun(); // Execute registered requests or the specified single request. } ===== Precautions ===== * Keep calling the Slave or Master execution function in ''loop()''. * The data array size must be at least the requested quantity. * Do not treat return codes BUSY and IDLE as communication failures. * When sharing ''M'' and ''D'' with Cnet/MC Protocol, define a single final size and initialization order. Do not call ''ImodbusRTUMem()'' or ''ICnetMem()'' again at runtime. * Memory allocation functions do not return success status. For nonzero sizes, verify that ''M'' and ''D'' are not ''nullptr'' before accessing them in user code. ===== Built-in Commands in the Same Category ===== * [[:en-us_commands:reference:imodbusrtumasterinit|ImodbusRTUmasterInit() View detailed description]] * [[:en-us_commands:reference:imodbusrtumaster|ImodbusRTUmaster() View detailed description]] * [[:en-us_commands:reference:imodbusrtumasteradd|ImodbusRTUmasterAdd() View detailed description]] [[:en-us_commands:builtin|← Built-in Command List]]