Before everyone tells me you can't have an output in a Function how much space does the CoDeSys compiler take if this pseudo code was a Function, Program, or Function block? What speed hits might you take using either one?
One reason for asking is when there are POU's that I develop that will only have one instance (no reason to make multiple instances (FB)) but multiple outputs I create them as programs. I don't know what over head a program would have over a function block other than the program is like a function which you can not create an instance and is only located in one place in memory. But since a program has more "features", stores variables from last execution, known globally throughout the program etc.. than a function how are they different in memory? The main thing I can see is there needs to be space in RAM for all variables of a program because they remain persistent during the next call. A function can be loaded and discarded.
When it comes to counting the amount of POU's used in a project a FB is counted twice one for the original FB and once for the instance. A function and Program are only counted once.
What do you think?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Before everyone tells me you can't have an output in a Function how much space does the CoDeSys compiler take if this pseudo code was a Function, Program, or Function block? What speed hits might you take using either one?
One reason for asking is when there are POU's that I develop that will only have one instance (no reason to make multiple instances (FB)) but multiple outputs I create them as programs. I don't know what over head a program would have over a function block other than the program is like a function which you can not create an instance and is only located in one place in memory. But since a program has more "features", stores variables from last execution, known globally throughout the program etc.. than a function how are they different in memory? The main thing I can see is there needs to be space in RAM for all variables of a program because they remain persistent during the next call. A function can be loaded and discarded.
When it comes to counting the amount of POU's used in a project a FB is counted twice one for the original FB and once for the instance. A function and Program are only counted once.
What do you think?
Hi,
This is really very interesting discussion.
I have done the same obesrvations regaurding the POU's(as u have said above)
a) FB:
Thus, we see the principle difference between functions and function blocks is the fact that internal memory allows function blocks to return different outputs despite repetition of the same input.
b)FC:
The reason that the same value is returned EVERY time is because there is no internal memory for the function which would impact its execution differently from one invocation to the next.
c)PGM:
I have attached an Architecture for PGM and FB, i think its self explainatory.
But i think PGM will take more internal memory then FB this is major overhead,an i agree with ur other explainations regaurding PGM(I still dont have any answer).
I just wanted to ask one thing what is the limitation for for FB,FC and PGM in terms of CODE
like how many instruction we can code in ONE FB,ONE FC and ONE PGM
My coustmer is aking me the same thing, i will be very greatful for ur reply.
Thank you,
Regards
Kiran
π
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a question regarding the size allocated for certain POU's by CoDeSys:
If I have the following pseudo code:
Before everyone tells me you can't have an output in a Function how much space does the CoDeSys compiler take if this pseudo code was a Function, Program, or Function block? What speed hits might you take using either one?
One reason for asking is when there are POU's that I develop that will only have one instance (no reason to make multiple instances (FB)) but multiple outputs I create them as programs. I don't know what over head a program would have over a function block other than the program is like a function which you can not create an instance and is only located in one place in memory. But since a program has more "features", stores variables from last execution, known globally throughout the program etc.. than a function how are they different in memory? The main thing I can see is there needs to be space in RAM for all variables of a program because they remain persistent during the next call. A function can be loaded and discarded.
When it comes to counting the amount of POU's used in a project a FB is counted twice one for the original FB and once for the instance. A function and Program are only counted once.
What do you think?
Before everyone tells me you can't have an output in a Function how much space does the CoDeSys compiler take if this pseudo code was a Function, Program, or Function block? What speed hits might you take using either one?
One reason for asking is when there are POU's that I develop that will only have one instance (no reason to make multiple instances (FB)) but multiple outputs I create them as programs. I don't know what over head a program would have over a function block other than the program is like a function which you can not create an instance and is only located in one place in memory. But since a program has more "features", stores variables from last execution, known globally throughout the program etc.. than a function how are they different in memory? The main thing I can see is there needs to be space in RAM for all variables of a program because they remain persistent during the next call. A function can be loaded and discarded.
When it comes to counting the amount of POU's used in a project a FB is counted twice one for the original FB and once for the instance. A function and Program are only counted once.
What do you think?
Hi,
This is really very interesting discussion.
I have done the same obesrvations regaurding the POU's(as u have said above)
a) FB:
Thus, we see the principle difference between functions and function blocks is the fact that internal memory allows function blocks to return different outputs despite repetition of the same input.
b)FC:
The reason that the same value is returned EVERY time is because there is no internal memory for the function which would impact its execution differently from one invocation to the next.
c)PGM:
I have attached an Architecture for PGM and FB, i think its self explainatory.
But i think PGM will take more internal memory then FB this is major overhead,an i agree with ur other explainations regaurding PGM(I still dont have any answer).
I just wanted to ask one thing what is the limitation for for FB,FC and PGM in terms of CODE
like how many instruction we can code in ONE FB,ONE FC and ONE PGM
My coustmer is aking me the same thing, i will be very greatful for ur reply.
Thank you,
Regards
Kiran