pmhpostman

Change the value of a variable based on the status of a bit using function block programming

4 posts in this topic

I'm having trouble with some very basic programming using function blocks. Specifically Connect Components FB programming, but I think it is a general, common application.

Using ladder logic, it is easy to set a value based on the status of a bit. If the bit is false, move a zero into the variable. If the bit is true, move and 88.0 into the value. This relies on the enable bit of the mov instruction in ladder logic. Many function block instructions do not have enable bits. How would I change the value of a variable based on the status of a bit using function block programming?

A real world example:

You have a two position selector switch. If it is turned to the left, the drive runs at 0 Hz. (off) if it is to the right, it runs at 88.0 Hz. Or if you have a 4 position selector and want to select between 4 speeds. This should be a simple task, right? I've called the tech connect support line a few times and sent them a few emails and they haven't been able to figure it out. This is such a basic task.

Thanks,

Pat

basic function block issue.jpg

Share this post


Link to post
Share on other sites

Use a Select statement with an Array(4)

Edited by a062549

Share this post


Link to post
Share on other sites

You could write your own AOI with structured text and make it do what you want it to.

Share this post


Link to post
Share on other sites

I did find a SEL (Select statement) in RSLogix 5000, but it is not present in Connected components. It would do what I'm looking for though, thanks. 

I could write my own function block in statement list (and one in ladder logic), which I have done, but it seems like if you are programming in function block, you shouldn't need to be writing statement list. If the enable input were there, it would be a lot quicker/easier. Where's the logic in function block? 

I am going to post a more general question about the enable input on function block.

Pat

Edited by pmhpostman

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