Modbus Write Specific Function Code 42

The underlying modbus node package does not support custom FCs.

Your choices are...

  • raise a "Feature Request" on the github repo + cross your finger :crossed_fingers:
  • fork, add "custom FC feature", publish a PR (pull request), wait for developer to merge an release.
  • fork, add "custom FC feature", publish an alternative node in NPM.
  • DIY it - here is the basis for a DIY solution

As for your error...

You have asked Buffer Parser to use 6 bytes (but only supply it with 4 bytes)

The proper solution to convert a buffer of bytes into an array of integers is to use the length -1 (it is documented in the built in help)


Y