Jump to content

Comparison function block issue


Recommended Posts

I am trying to make a comparison between an analogue input value (MI) and a constant (10) using the "Greater than" function block. 
So, normally if the MI > than 10 then a MB become true. 

Looks like the comparison function block works (became red) in the Online test, but is not passing the value to the MB (the MB value stays black). 

I am using the function block as it is described in the Visilogic - Ladder Programming manual (attached the section from the manual). 

 

What  I am doing wrong?

 

Cheers

post-25198-0-28264800-1413543159_thumb.png

Link to comment
Share on other sites

Hi Navigatoru,

 

Is the compare statement is a subroutine? Is the subroutine running?

 

Is MB50 used elsewhere in the application? If so, try to link a new unused MB. It may be that MB50 is controlled elsewhere in the application. 

 

Thanks,

 

Dan

Link to comment
Share on other sites

One possible issue may be your MI value, are you scaling it? If so, does your constant scale correctly?

 

Use as much precision as you can.  Say you're reading in the analog input and scaling it from 1-10 volts.  You lose a lot of precision from rounding as integers don't hold anything right of the decimal.

 

If you're using an integer I recommend ensuring your scale is set to 1000-10000, your precision now becomes 1.000 to 10.000, then you have to scale your constant to match.  IE, 10 becomes 10000 in your comparison function.

 

Also, keep in mind, MB 50 may be updating hundreds of times per second and the value may not hold true each time it updates and you may not see it turn "red" unless you have some sort of latch to hold your state on.

 

As Dan said as well, something else may be turning 50 off later as well, though you should see a warning when you build and test the code.

 

It would be useful to see a screen shot of the rungs used to control your comparison and your output, or a copy of the program.

 

-Chris

 

*Edit*

 

An easy way to verify the output is working is to put all constants into your comparison block, but based on the information given, you have logic/programming error somewhere.

Link to comment
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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.