Jump to content

Recommended Posts

I have a project that reads the 16 bit registers from a slave device and have a problem with reading the unsigned value. I have worked out a way to read the value. if the value is positive, then I read it directly. If the value is negative, I add the value to 65535 and store it in a long location. I was wondering if there was a cleaner way of doing this.

Link to comment
Share on other sites

  • MVP 2014

I took a quick look and the Modbus Read Holding Registers function allows you to assign DW as the Master Start of Vector. So you should be able to drop the unsigned 16-bit values directly into DW operands, which are 32-bit unsigned type. That sounds like a solution, but give it a try first.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.