Professional OPC
Development Tools

logos

Problems getting 16bit int from PLC

More
17 Oct 2019 15:41 #7842 by support
If the value in the server is *unsigned* 16 bits, you will get signed 32 bits (Int32). It has been like for many years. This is behavior is mainly there to support VB.NET.
See: - opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...ypes%20in%20OPC%20Classic.html

If the value in the server is signed 16 bits, when reading you will get the same signed 16 bits (Int16) without conversion. If not, I will need a reproducible scenario, but I highly doubt that is the case.

Writing is separate. First, nothing prevents you to convert the value to the type you like. Second, assuming that were are talking about OPC Classic and not OPC UA, any OCP compliant server is supposed to make the necessary conversions upon writing, so it does not really mater what type you write in, as long as the value fits.

Best regards

Please Log in or Create an account to join the conversation.

More
17 Oct 2019 15:33 #7841 by Hes
Hello everybody!
I am using QuickOPC 2019.1 and i am experiencing a problem i've never had with the previous version. When i try to read 16bit int, the value i get is a 32bit int. I am sure the value in the PLC is declared as 16bit, and i am also using Matrikon browser for checking and the data type is 16bit int. But the data i get is a 32bit int, meaning that even if i can read it in some way, i cannot write to the PLC, getting an exception.

Is this an issue or am i doing something wrong? Please notice that the only thing that is changed from previous version is only the quickOPC version, i have changed nothing in my code and it worked perfectly.

Thanks in advance to anyone who will help me

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.150 seconds

      

 Recommend this on Google