Lupin_III

saia SAIA PLC - Modbus TCP truncates 32 bit value

14 posts in this topic

HI, I'm reading values from an SBC SAIA PLC ( PCD2.M5540 model). My problem is that some values are 32 bit, while modbus return 16 bit values, of course. Registers are consecutive, so I cannot read for example 9008 and 9009 since they store 2 different information.
To make it clearer I attach the PLC watch window. As you can see R9009 is a 32 bit value, but I can't require R9009 and R9010 via modbus since in R9010 register there is a different information. AS well as in R9008. Speaking with SAIA technical support, they explain me that their PLC registers are natively 32 bit, so in order to read them I need a 32bit modbus client. I cannot find anything like this, neither I can use standard modbus, since the buffer I get back is a 16 bit for each register. So 16bit for R9008, 16bit for R9009, 16 bit for R9010. What I can do?
Thanks

PLC.jpg

Share this post


Link to post
Share on other sites

I've encountered this before.  It was a technique started by Enron, and persists in some industries.  Most Modbus implementations cannot talk to such non-standard devices.  I believe Kepware supports "Enron Mode".  I don't know of anything else outside the oilfield world.

Share this post


Link to post
Share on other sites

Thanks. After more research it seems that I have to find which register these are are linked to, the standard one that allow modbus protocol. So now I need someone that knows this PLC. 

Share this post


Link to post
Share on other sites

Hello,

Or perhaps you could use a program, like PeakHMI, that can access the SAIA PLC using native SAIA protocol.

FYI, SAIA uses the "Motorola Fast Floating Point", FFP for floats.

Share this post


Link to post
Share on other sites

Thanks Mark. I had a look at it. The problem is that I neeed to integrate it in another program. This will leead to a dedicate saolution just for this PLC. So, I need to use standard modbus.

Share this post


Link to post
Share on other sites

The devices I've encountered that use this bastardized Modbus with 32-bit registers simply do not work with standard Modbus.  You might need a custom solution for that PLC, or consider replacing the PLC with something that follows the standard.

Share this post


Link to post
Share on other sites

I don't know anything about SAIA, but I really do believe that there ways to copy this registers in memory and convert them bit by bit. I takes little bit of time and little bit of knowledge, but it is doable. 

Share this post


Link to post
Share on other sites
2 hours ago, Goran Vuckovic said:

...but I really do believe that there ways to copy this registers in memory and convert them bit by bit.

IIRC, the PLC provides routines to convert from/to SAIA native Motorola FFP and IEEE 754.

Edited by Mark-

Share this post


Link to post
Share on other sites

I read the explanation about the Motorola float format a few minutes ago and if I understood correctly, it is as following:

MMMMMMMMMMMMMMMMMMMMMMMMSEEEEEEE (every letter represents bit position)

Where M is mantisa, S is sign and E is exponent.

On other side IEEE 32 bit float format is:

SEEEEEEEEMMMMMMMMMMMMMMMMMMMMMMM

Just by looking at it, it seams to that simple bit(s) shifting to the left will convert from Motorola float to IEEE, and shifting to right will convert from IEEE to Motorola float. Just you need to bear in mind to remove or add that extra bit in exponent.

Never done it and I have never used Motorola float but it looks like that.

Edited by Goran Vuckovic
Forgot to add additional explanation

Share this post


Link to post
Share on other sites

Keep in mind that the floating point format issue is independent of the Modbus protocol issue.

Share this post


Link to post
Share on other sites
On 11/21/2022 at 4:09 PM, Goran Vuckovic said:

Just by looking at it, it seams to that simple bit(s) shifting...

Interesting. What about the byte order?

The next day. Years ago I wrote some routines to covert to/from FFP - 754. I went and looked at the code and while it has some bit shifting it is not only shifting. For example the exponent is biased differently. If you have some working code that converts both directions, is only shifting and maybe an and/or or two, I would really like to see and test the code.  

Edited by Mark-

Share this post


Link to post
Share on other sites
Quote

If you have some working code that converts both directions, is only shifting and maybe an and/or or two, I would really like to see and test the code.  

As I stated before, I never had experience with FFP - I was just reading FFP datasheet. If you can send me two examples of FFP values, represented in real format and bit values I could try to do it in ST. Just for fun and it may help to OP.

Share this post


Link to post
Share on other sites
1 hour ago, Goran Vuckovic said:

As I stated before, I never had experience with FFP...

Right, I thought you might have created some since your post. Check you PM, I sent a small program.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now