I've created a function block with actions. In a seperate program written in ladder logic, I've created an instance of the function block. Now how do I specifically call that action on a rung?
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
so you made a function block and some actions in it.
now you have a ladder program and you want it to run one of these actions.
set the mouse on the rungline and click.
Insert a FB, you will see a AND block appearing, press F2 and look for your action under user definned blocks. there is a small plus sign to find your action.m double click it and it will be in your program.
give it a name and automatically it will be defined in the VAR list.
every action needs to have a unique name in the var list even if same action is used more then once.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks shooter. This is the second time you've helped me
Question though: why do I need to call it with a unique name? I tried calling it with the same name and the program functions as expected. You had mentioned on another post that it was hard to control in codesys when calling it this way, I'm just trying to understand why.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if you call the same actionname twice you get the results from the previous one.
you can try this by adding one to a local variable inside your action(well it is defined inside the function block).
If you call it again you will see the number doubles.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I've created a function block with actions. In a seperate program written in ladder logic, I've created an instance of the function block. Now how do I specifically call that action on a rung?
Thanks!
so you made a function block and some actions in it.
now you have a ladder program and you want it to run one of these actions.
set the mouse on the rungline and click.
Insert a FB, you will see a AND block appearing, press F2 and look for your action under user definned blocks. there is a small plus sign to find your action.m double click it and it will be in your program.
give it a name and automatically it will be defined in the VAR list.
every action needs to have a unique name in the var list even if same action is used more then once.
Thanks shooter. This is the second time you've helped me
Question though: why do I need to call it with a unique name? I tried calling it with the same name and the program functions as expected. You had mentioned on another post that it was hard to control in codesys when calling it this way, I'm just trying to understand why.
if you call the same actionname twice you get the results from the previous one.
you can try this by adding one to a local variable inside your action(well it is defined inside the function block).
If you call it again you will see the number doubles.