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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...