Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTU Request sometimes sent with leading eight 0x00 words #83

Open
BastianGschrey opened this issue Feb 5, 2017 · 0 comments
Open

RTU Request sometimes sent with leading eight 0x00 words #83

BastianGschrey opened this issue Feb 5, 2017 · 0 comments

Comments

@BastianGschrey
Copy link

ModbusMaster version

2.0.1

Arduino IDE version

1.8.1

Arduino Hardware

DUE

Platform Details

Windows 10 x64


Scenario:

Communiction with a CAR ecu that talks modbus. It's working, the problem is that I get malformed requests sometimes

Steps to Reproduce:

This is my code:

void readModbusRegister()
{

  ecu.readHoldingRegisters(4097, 6); //read 6 registers beginning from offest 4097

  if (result == ecu.ku8MBSuccess)  //if transmission is good, decode Data
  {
    decodeModbusRegister();

  }

}


void decodeModbusRegister()  //read  word registers and write into data array
{

  for (j = 0; j < 6; j++)
  {
    data[j] = ecu.getResponseBuffer(j);
  }

  printValues(); //after decoding, print data
}

Expected Result:

Request is sent for 6 registers.

Actual Result:

Its working but sometimes the request packets are malformed:

 01 03 10 01 00 06 90 C8  <--- Good request
 01 03 10 01 00 06 90 C8  <--- Good request
 01 03 10 01 00 06 90 C8  <--- Good request
00 00 00 00 00 00 00 00 01 03 10 01 00 06 90 C8   <--- malformed request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant