Hi Guys
How do you map the inputs for your machine when using FB's?
btw I'm using Twincat 3/Codesys.
Right now I map all the input/output to global variables and use the input as input to the FB's and the FB outputs sets the global outputs in the main loop.
So ex.
and then
I have also seen people mapping the in/out directly in the FB's directly.
That way you need to instantiate each FB first to map input to.
I can see positive and negatives in each approach just looking for some best practice from the experts.
How do you map the inputs for your machine when using FB's?
btw I'm using Twincat 3/Codesys.
Right now I map all the input/output to global variables and use the input as input to the FB's and the FB outputs sets the global outputs in the main loop.
So ex.
Code:
bIn1 AT %I* : BOOL;
bOut1 AT %Q* : BOOL;
fbTest : FB_TEST;
and then
Code:
fbTest(bIn:=bIn1);
bOut1 := fbTest.bOut;
I have also seen people mapping the in/out directly in the FB's directly.
Code:
FUNCTION_BLOCK FB_TEST
VAR_INPUT
bIn1 AT %I* : BOOL;
END_VAR
VAR_OUTPUT
bOut1 AT %Q* : BOOL;
END_VAR
VAR
END_VAR
That way you need to instantiate each FB first to map input to.
I can see positive and negatives in each approach just looking for some best practice from the experts.