Okay, I'm stuck. I'm trying to do a Modbus TCP read from a device only has 64-Bit Double Little Endian Input Registers. Modbus Poll can bring in the data correctly when selecting the data format as 64-Bit Double Little Endian but Ignition does not when doing a "Input Register Double" with a direct Modbus Address. I've tried doing [Device]1.IRD30001 with data type set to Double and tried [Device]1.IR30001 with data type set to Double. I've tried swapping the word order on the Device Connection as well.
I've also tried to do four individual integer reads and then created an expression tag to bring all four words in and changing around the word order with "stringFormat("%d%d%d%d", {[~]1_IRD30001}, {[~]1_IRD30002}, {[~]1_IRD30003}, {[~]1_IRD30004})".
Any other suggestions out there? The closest I've found on Ignition is the Omron Fins driver with setting the type as @LE but that failed.
I get values from most of the ways I've tried but just not the correctly formatted value...
This is probably the approach you need, except string formatting doesn't do what you want. You need to use bitwise operators to combine the 4 registers.
edit: ooph, nevermind, it's actually a little trickier because it's a Float/Double and not a Long... will require scripting... hang on.
Would the data type for each tag still be Double with the IR? How about the final tag data type? I just tried your suggestion on an expression tag and it returns Error_ExpressionEval
Did you create a script in the library called "ByteUtils" and add that function? Is your "Gateway Scripting Project" set to the project containing this library?
I did not...sorry. Added to the Project Library now as you wrote it with the W1, W2... Pardon my ignorance but do I need to change those to a tag reference in the Project Library? And how does the runScript {[~]W1} need to be changed to reference each tag?
Still getting the error. The link to the manual refers to placing the project name in the Gateway Settings but I am not seeing a field for Gateway Scripting Project to place the project name.
I'm sure I'm still doing something wrong...
Thanks for all the help on a Saturday morning! You as well @pturmel
Update: Error_TypeConversion("Invalid value: Tag value is Infinity or NaN.")
In the Script Console it works to output a value when I define the w1..etc with integers manually but I get nan if any of the values entered are a negative.
I can't tunnel in using ModPoll while remote so I'm not sure what the current values are. I'm pulling in 5 registers with temperature being one of them. I'm trying the other register groups now but I'm getting the small 0 value on all attempts so far.