Luciak Posted May 15, 2012 Report Share Posted May 15, 2012 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 ) 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? Link to comment Share on other sites More sharing options...
Ofir Posted May 15, 2012 Report Share Posted May 15, 2012 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. Link to comment Share on other sites More sharing options...
Luciak Posted May 15, 2012 Author Report Share Posted May 15, 2012 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 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