IMPORTANT: all read and write functions start a Modbus transmission, but they are not It requests for 6 registers starting at address 0 Send a Read Input Registers request to the slave with address 31 Send a request every 1000ms if connected to slave In this case the connection is opened once The ethernet connection is managed by the application, not by the library NOTE: it is not necessary to start the modbus master object Ethernet client object used to connect to the slave You should have received a copy of the GNU Lesser General Public License GNU Lesser General Public License for more details. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program is distributed in the hope that it will be useful,īut WITHOUT ANY WARRANTY without even the implied warranty of The Free Software Foundation, either version 3 of the License, or It under the terms of the GNU Lesser General Public License as published by This program is free software: you can redistribute it and/or modify Modbus TCP Master Input registers reader code:Ĭopyright (c) 2018 Boot&Work Corp., S.L. The ModbusResponse implements some functions to get the response information: There is the available() function to check for responses from the slave. If there is a pending Modbus request or the client is not connected, they return false. They return true or false depending on the current module state. It is important to notice that these functions are non-blocking, so they do not return the read value. On a multiple write function the values argument is an array of values to write. On a multiple read/write function the address argument is the first element address. A coil is represented by a bool value and a holding register is represented by a uint16_t value. Depending on the function the data type changes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |