Jump to content
Luciak

V130 and reading Siemens Flowmeter via MODBUS

Recommended Posts

Hi,

I have to read Siemens Flowmeter (MAG 6000) via MODBUS and all of this I want to do with V130.

The problem is with Siemens' memory map (they are just oing it different than everybody else :P ) as they have swaped values.

I have to read a float value which is of course 4 bytes (2 holding registers). As I read them, I get registers filled in V130 with data like this: AA BB CC DD. But to display those values as on Flowmeters screen I have to show them as CC DD AA BB.

And here is my problem.

When I read the value as MF, I have to change bytes order inside the MF register (from AA BB CC DD to CC DD AA BB) - couldn't figure out how to do that :/

or

when I read the value as 2 x MI, I put them in the right order (CC DD AA BB) but than I have to put the together into one MF register - couldn't figure this out neither :/ (convert function from Math->Float->Convert menu is not giving me the right value).

Any tips on this?

Share this post


Link to post
Share on other sites

Hi,

Basically you need to use the function Swap bytes. (under vector menu).

Since Swap Bytes does not support MF then you need first to use Copy memory function to copy the bitmap of the bits from MF to DW.

Then you use Swap bytes on this DW and use copy memory to set it back from DW to MF.

Share this post


Link to post
Share on other sites

Great - thanks :)

I just love those moments when one little word triggers the thinking process or "opens" the eyes :)

I was thinking about such solution but couldn't find any function to copy MF to DW. Found it through Help thanks to Your tip.

And as swap function swaps only like this:

16bit -> from AA BB CC DD to BB AA DD CC

32bit -> from AA BB CC DD to DD CC BB AA

So to receive my CC DD AA BB I had to do something like:

Copy memory MF to DW -> Swap bytes 32bit -> Swap bytes 16bit -> Copy memory DW to MF

And it works fine :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...