Sign in to follow this  
Followers 0
James Fillmore

Help converting 4 SINTs to REAL

6 posts in this topic

If I can get help converting the (4) SINT's to a DINT then I think i can just MOV the DINT to a REAL. Thanks

Share this post


Link to post
Share on other sites
Found the info right here on MrPLC. COP (Copy File) Source: SINT[0] Dest: REAL Length: 4

Share this post


Link to post
Share on other sites
I hope that works out for you. However, I have found in a lot of cases the Bytes don't come in the right order for a simple COP. If you find that, have a look at the SWPB Instruction. It might take a little trial and error to find the right combination. Stu.....

Share this post


Link to post
Share on other sites
Length is destination address length. It should be 1.

Share this post


Link to post
Share on other sites
Why does that instruction work no matter what I put for the Length (tried 1, 4, 6) all worked? Also what is the math behind 4 SINT's representing a REAL?

Share this post


Link to post
Share on other sites
With the 'Length' numbers larger than 1 the COP is copying data which lies past the 4 SINT's in memory and placing them beyon the Real, probably messing something up. leave it at 1. A SINT is 8 bits long. A Real is 32 bits long. Somewhere a Real existed and something (you didn't define what) chopped it up into 4 SINTs without messing up the bit pattern within each 8 bit segment and, suprisingly, maintained the order of the 4 SINTs. We usually aren't that lucky. For more in-depth about SINT's and Reals, check out the structure of each. SINT's are fairly easy. For Reals try 'Floating Point' in Wikipedia. Edited by b_carlton

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
Sign in to follow this  
Followers 0