Description
I am doing a coding test using Arduino board.
Unwanted results occur during testing.
If you try to read data remotely after inserting m_Modbus.Ists value, an error occurs in multiples of 8.
I think that the Modbus.cpp file contains an error in the void Modbus :: readInputStatus () function.
please check.
Temporarily modifying and testing as below.
#if 0 while (numregs--) { i = (totregs - numregs) / 8; if (this->Ists(startreg)) bitSet(_frame[2+i], bitn); else bitClear(_frame[2+i], bitn); //increment the bit index bitn++; if (bitn == 8) bitn = 0; //increment the register startreg++; } #else do{ i = (totregs - numregs) / 8; if (this->Ists(startreg)) bitSet(_frame[2+i], bitn); else bitClear(_frame[2+i], bitn); //increment the bit index bitn++; if (bitn == 8) bitn = 0; //increment the register startreg++; } while (numregs--); #endif