simonongsk

2 Words to Real

4 posts in this topic

Hi:

      There are 2 Word, Let say  Word_0 = 5c29, and Word_1=3e8f, I combined that 2 word into  DWord=3e8f5c29; The result converted online (https://www.scadacore.com/tools/programming-calculators/online-hex-converter/) to Float will be 0.280 (expected result).

 

But with DWORD_To_Real , i get this result :    1.0354898e+09    REAL       

 

May I know how to convert the 2 words into Real (Float ?)

Omron PLC: NX1

 

 

Share this post


Link to post
Share on other sites

You need to use CopyDwordToReal if it is a bit pattern move.

Capture.PNG

Share this post


Link to post
Share on other sites
7 hours ago, photovoltaic said:

You need to use CopyDwordToReal if it is a bit pattern move.

Capture.PNG

@photovoltaic Wow, that is weird command name TBH. The CopyDWordToReal seem to work, may i know what do you meant by  "if it is a bit pattern move"  I wonder why DWORD_To_Real did not work as the command name suggested or are there any more conversion command for Dword to Real?

Share this post


Link to post
Share on other sites
5 hours ago, simonongsk said:

@photovoltaic Wow, that is weird command name TBH. The CopyDWordToReal seem to work, may i know what do you meant by  "if it is a bit pattern move"  I wonder why DWORD_To_Real did not work as the command name suggested or are there any more conversion command for Dword to Real?

Bit pattern is literally a bit for bit move. The general conversion instructions just take the decimal value and make it the new datatype which rarely works with reals in these scenarios

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