Skip to content

The result is an error. #42

Open
Open
@acabia

Description

@acabia

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.
di-error2
di error 1

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

di-ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions