nicepal

CJ2M Function Block String to Real

3 posts in this topic

I have this issue. working on Omron's CJ2M.

String received can be +4.24737E-03 or +2.17737E+01

Somehow, the structure text function does not have STRING_TO_REAL.

We need to extract some readings from a Meter and do some value comparison in the PLC to set the passing range. Any advise I can get from personnel here?

Share this post


Link to post
Share on other sites

The FVAL(449) instruction should do wat you are looking for.

Share this post


Link to post
Share on other sites

Seems the FVAL is in the Ladder format. Under Structure Text, like don't have direct.

Anyway, I have work around this by extracting the Integer part to a DINT -> Real, the Decimal part to another DINT -> Real -> Convert into Decimal value. Add them together. Then check if it is E+ or E-, and Multiply or Divide according to the E number.

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