yaacov / ArduinoModbusSlave

Modbus slave library for Arduino
ISC License
204 stars 74 forks source link

Doesn't work on arduino mega 2560. #60

Open qqq-tech opened 4 years ago

qqq-tech commented 4 years ago

Modbus :: createResponse (); If there is no delay (1) or Serial.println ("") before calling the function, it does not work properly.

communication:rs232 baudrate:9600 dataBits:8 Parity:None StopBits:1

uint8_t Modbus::poll()
{
.....
    // Validate the incoming request.
    if (!Modbus::validateRequest())
    {
          Serial.println("notvalid");
        return 0;
    }
   //Serial.println("valid");
    //delay(1);
    // Execute the incoming request and create the response.
    uint8_t status = Modbus::createResponse();
}
falahati commented 4 years ago

Please provide information about what exactly happens. Does the library read the full request and the validateRequest() method passes? Does your callback gets executed? Do you get bad response or no response? What is your callback function, please post it here.