cuongvcs

Convert 2 INT to Real in Sysmac Stusio

4 posts in this topic

Dear All.

I have the issued with NX1P2 when read data from Modbus RTU. the Slave data using 2 INT for Real data. but in the Sysmac Studio I get the data is OK, 2 INT but can not convert to Real data.

Can you pls help me to solve this issued. also I want to convert from Real to 2 INT to send the setting to salve.

Many thanks.

Share this post


Link to post
Share on other sites

Have a look at the CopyRealToDword and CopyDwordToReal functions. You may need to do a byte swap, depending on the byte order Modbus is communicating. 

Share this post


Link to post
Share on other sites

Depending on the manufacturer I have seen REALs come in either byte swapped or completely backwards. If a straight CopyDwordToReal doesn't work use ToAryByte and shuffle things around then use AryByteTo and move 4 bytes into a REAL.

 

 

 

 

Share this post


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

Depending on the manufacturer I have seen REALs come in either byte swapped or completely backwards. If a straight CopyDwordToReal doesn't work use ToAryByte and shuffle things around then use AryByteTo and move 4 bytes into a REAL.

Dear Friend.

I just do same your advise and it work OK for me. and I build 2 Block AOI for easy to using.

Many thanks,

 

 

 

 

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