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

short and ushort with Modbus RTU #48

Closed
GoogleCodeExporter opened this issue Oct 2, 2015 · 2 comments
Closed

short and ushort with Modbus RTU #48

GoogleCodeExporter opened this issue Oct 2, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

I am using a Trio Motion controller, connected via USB for programing and 
with serial / Modbus for data transfer to run a custom application. 

What steps will reproduce the problem?
1. try to write 38000 in a register "master.WriteSingleRegister(slaveID, 
vrID, value);"

What is the expected output? What do you see instead?
In the controller, the written value is -27536.0, it should be 38000. 

What version of the product are you using? On what operating system?
 - Windows XP SP3, with version 3.5 installed
 - My program in in C# in Visual Studio 2005
 - Modbus.dll 1.11.0.0
 - log4net.dll v1.2.10.0

Please provide any additional information below
On the trace I am doing, up to the "master.WriteSingleRegister(slaveID, 
vrID, value);", the value is in a ushort variable. I will have to install 
Visual Studio 2008 to try debugging in the Modbus.dll.

Cheers !!!


Original issue reported on code.google.com by jsomvi...@durstcanada.com on 18 Jun 2009 at 8:03

@GoogleCodeExporter
Copy link
Author

I don't see how this could be an NModbus issue. How are you reading the value 
back
from your device? My guess is you're using the wrong numbering format... the 
register
value is assumed to be an unsigned integer.

Original comment by sja...@gmail.com on 19 Jun 2009 at 12:37

@GoogleCodeExporter
Copy link
Author

Hi,
When I read back the value from the nmodbus library, the value is the same 
(38000) 
so the library is consistent. 

After doing some more research, I realized that my controller registers were in 
32 
bit floating point (signed). The old way I was used to connect to it used 
Modicon 
Modbus protocol (enabling floating point data transfer) So if i understood 
well, 
using the nmodbus library I cant write in the memory of my the controller a 
true 
signed 16 bit Integer. Because once the packed is recieved by my controller it 
will 
convert the value to a signed short. One solution to this is to convert the 
value 
back (in the controller) to a unsigned. I didnt open the library yet in .NET 
2008. 
Do you think is is feasable to modify the library to accept different numbering 
format?

Thanks a lot and very nice work with this library, It helped me a lot realizing 
my 
project. 

Original comment by jsomvi...@durstcanada.com on 30 Jun 2009 at 1:03

@mesta1 mesta1 closed this as completed Feb 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants