atomic_robo

FB's

6 posts in this topic

Hello,

I am using function blocks multiple times to execute motion commands. The function block has a few MOVE instructions that would move the motion profile values to the drives. I noticed that the PLC only keeps the last value. Meaning, the values always zeros. How do I go about this issue?

Thank you all

Share this post


Link to post
Share on other sites

If you execute them at the same time, then the last one will be the one that is valid.  You get around this by only executing one at a time.  I am not sure if this is exactly what you are asking, but we should start here.  If you are having some other issue, please provide more information.

Share this post


Link to post
Share on other sites

Thank you Michael. Any ideas on how to execute a FB one at a time?

Share this post


Link to post
Share on other sites

The short answer is, the motion instructions will execute with a differential pulse. So if you have a sequence that is latching its steps, then using the differential pulse will execute them one at a time.

If you show us your example then we may be able to give you a clearer solution.

Share this post


Link to post
Share on other sites

@atomic_robo
I have seen your PM, but then this thread show up. So I guess better having an open discussion here.

I got two possibilities for your case. First method is the most simple, by having multiple FBs executed one by one. In the screenshot, you can see each FB have a "Done" output to indicate whether the execution of that movement is finished. This output is used to trigger the next FB in sequence.

Simple.JPG.107f53fcb1aa130724e4d92b36118

The other method, although requires more thinking, is the one I like the most since it will save program memory by using only one FB for the entire sequence. You need to have a variable to indicate which movement sequence is to be executed. Notice that the "Done" output of the FB is used as Normally-closed Interlock so that when the FB has completed one movement, it will re-execute itself (granted that the Done output is a one-shot trigger inside the FB and not a SET Coil).

MoreMemorySaving.JPG.84200a8896239615ff9

Regarding the "Done" part though, as I mentioned in the other thread, you need to find a part of the Ethernet/IP Tag on that device which indicates that the movement is completed (something like Done / Flag / Busy is a typical name used for EthernetIP devices. If you can post a screenshot of the EthernetIP Input and Output mapping of your stepper motor, we might be able to suggest which might be the correct flag.

 

Share this post


Link to post
Share on other sites

Hi, 

Thank you for your reply! I think the done bit has to be created in the function block. And, yes there's a bit that indicates a motion is complete (Change from 1 to 0). I think it would be safer to just use your first solution, i.e. using one function block for all the motions. 

 

Thank you @innoaloe again :) 

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