ThePLCPeon

FX3U CPU comparing floats

4 posts in this topic

Hello, I am currently using some floats/reas in my code that i would like to compare such as >, <, >=, <=, and = . The instruction I am using at the moment is [DECMP DX DY MZ] which dos work.

I find this to be harder to read and follow than using [> DX DY]. The m bit MZ  will go high when  DY < DX MZ+1 will go high when DY = DX and MZ+2 will go high when DY > DX. So my question is this; Is there an inctruction I can use to compare floats with simply one instruction ie the [> DX DY] format? Or am I limited to using the DECMP when working with floats?

Thanks.

Share this post


Link to post
Share on other sites

Something like this?      ( instuction  LDD)

 

 

Steve

snipit.jpg

Share this post


Link to post
Share on other sites

yes, will this work when using floats/reals? Also how does it read the instruction? For example i would read [D< D100 D102] as if D100 is less than D102 then the instruction would be true. Is that correct? Thanks for the help.

Share this post


Link to post
Share on other sites

Needs to be DE<> in an FX, not D.

D indicates double integer, DE for 32-bit real.

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