I have a signed int coming from a Adam 6017 module and need to convert it to a unsigned int.
I have read other topic and you guys want me to change it in the Adam 6017 but I can not. What can I do?
I have a signed int coming from a Adam 6017 module and need to convert it to a unsigned int.
I have read other topic and you guys want me to change it in the Adam 6017 but I can not. What can I do?
What driver are you using to read the value?
OPC-DA COM Connection
Hi,
Which OPC Server are you using? Is it possible that you can create an âaliasâ tag of some sort with a different datatype and do the conversion there?
If not, you might try the following: on the opc-com connection settings, turn on ârequest data typesâ. Then, on the tag (in Ignition), set the data type to âInt8â. Since we donât actually have âunsignedâ data types, itâs going to be necessary to use a larger data type anyhow, Iâm just not sure if your source value is a 2 byte or 4 byte value.
Hope this helps,
No, it is not possible to set up the alias in the OPC service. We did enable the ârequest data typesâ but still reading a negative integer number.
It depends what you mean by needing to convert it to an unsigned int. If youâre reading a value in from an Adam 6017 I assume itâs a 16-bit integer. A signed 16-bit integer will have a range of â32,768 to 32,767. An unsigned 16-bit integer will have a range of 0 to 65,535. To change from signed to unsigned you would simply add 32,768 to the number.
To do this in Ignition, read your input in to a SQLTag (say tag1), then create an Expression SQLTag and make its expression something like {[~]tag1}+32768
This does mean you need 2 SQLTags for each input, but theyâre free and if youâre creative with SQLTag names and folders it should still be clear what youâre doing.
Let us know if this is not what you are meaning.
I had the same question, with the same ADAM-6017 IO module and found a solution.
It is possible that this solution did not exist at the time of the original post back in 2012 but I thought Iâd post the current solution for others like me who come across this post looking for answers.
The solution is to use âHolding Registers with 16 bit unsigned integer conversionâ as the modbus type with the Ignition OPC-UA ServerâŚ
Examples:
Change OPC Item path from:
[{DeviceName}]1.HR4
to:
[{DeviceName}]1.HRUS4
For modbus address mapping change Modbus Type from:
Holding Register (Int16)
to:
Holding Register (UInt16)
Reference:
https://docs.inductiveautomation.com/display/DOC/About+Modbus+Addressing