mwis750 Posted February 9, 2015 Report Share Posted February 9, 2015 Hi, I've a working solution on Vision V570 - reading a temperature via Modbus as a float (done with MODBUS FB R.F.R #3). However, I cannot make it working on a UniLogic. It looks like problem with a float presentation or convertion. I'm able to read an uint16 array and check that read values can be converted into float (IEEE754) but reading it through configuration as a tag with REAL type returns incorrect values. Is it possible to read real values from Modbus ? How should I do it ? Thank you, Michal Link to comment Share on other sites More sharing options...
Eyal Koren Posted February 9, 2015 Report Share Posted February 9, 2015 Hi Michal, If you are getting wrong values for the R.F.R command, there is a good chance that your device sends a swapped message (the bytes order is reversed). In that case, you can use the Swap Single Tag Bytes ladder function block found in the Logic tab. change the swap type to ABCD_CDAB. Please let me know if that solved the problem. 2 Link to comment Share on other sites More sharing options...
mwis750 Posted February 12, 2015 Author Report Share Posted February 12, 2015 Hi, that solved the problem, thank you. However, I'd like to suggest adding special kind of an operation to Modbus configuration. That way all could be still just configuration. Also there is no way to find out when a new value has been read from a remote slave (is there ?), so what kind of condition should be used for such swap ? Regards, Michal Link to comment Share on other sites More sharing options...
Eyal Koren Posted February 12, 2015 Report Share Posted February 12, 2015 Regarding adding a swapped bytes feature - I will add a request to our features list. Regarding conditions for swapping - there are several approaches for such condition. I would use the following: Storing the original tag (lets name it A) to another 2 tags (lets name them B and C) Swapping the bytes in B Running a continuous compare function between the A and C - when A is different then C that means that another value was stored to the PLC and another swapping is necessary. Link to comment Share on other sites More sharing options...
rachitparikh8 Posted March 30, 2015 Report Share Posted March 30, 2015 Hi, I am also facing the same problem of floating integer with the unilogic software. Can you post any sample on how to use the swap single Tag byte instructions because I am not clear about it. Thank you Link to comment Share on other sites More sharing options...
s.pratt Posted March 31, 2015 Report Share Posted March 31, 2015 Hello, The Swap Single Tag Bytes tag will split the integer (16-bit or 32-bit) into two parts: two 8 bit parts for a 16-bit integer, or two 16-bit parts for a 32-bit integer. It will then switch the order of the parts, thus displaying a different number. For instance, if you read a 16-bit integer, but the bytes are backwards from what they should be, you can place this into the Swap Single Tag Bytes function, and choose the "Swap Type" in the B parameter. For a 16-bit integer, this is composed of two bytes, therefore the swap type will be AB_BA. For 32-bit integers, there a four bytes, and two different configurations can be chosen (ABCD_CDAB or ABCD_DCBA). So let's say I get a Hex value read in of 0x2301, but I was looking for a value of 0x0123. I would use this swap bytes function with a swap type of AB_BA, and the resultant of the tag would now read 0x0123. Please let me know if this helps or if I can clarify any further. Link to comment Share on other sites More sharing options...
rachitparikh8 Posted March 31, 2015 Report Share Posted March 31, 2015 Thank you for your reply. I tried using the swap single Tag byte function to read the floating point (32 bit) values via modbus RS485 communication in the Unilogic software but still not able to do it. I can read the INT16 bit values but not the Floating point 32 bit values Link to comment Share on other sites More sharing options...
s.pratt Posted March 31, 2015 Report Share Posted March 31, 2015 Hello, Try using a positive transition contact with the swap bytes function. Set up like shown below, the positive transition contact will be link to when you receive that float value. So when you receive the float value, it triggers the swap function block once (thus only switching the register bytes once, not every scan). Let me know if this helps. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now