ImodbusRTU() checks incoming requests and handles Slave responses.
void ImodbusRTU()
void ImodbusRTU(HardwareSerial& serialPort)
| Command | Arguments | Return Value | Operation |
|---|---|---|---|
ImodbusRTU() | None | void | Checks incoming requests and handles Slave responses. |
void setup() { ImodbusRTUMem(100, 200); // Set the M·D memory sizes used by the Slave. ImodbusRTUAdr(0, 0); // Set the start addresses of M·D memory. ImodbusRTUInit(Serial1, 1, 115200); // Set the communication port, station number and baud rate. } void loop() { ImodbusRTU(); // Check incoming requests and process Slave responses. D[0] = 100; D[3] = 200; }
loop().M and D with Cnet/MC Protocol, define a single final size and initialization order. Do not call ImodbusRTUMem() or ICnetMem() again at runtime.M and D are not nullptr before accessing them in user code.