Hello,
I'm trying to use VAR_CONFIG and I'm doing the nexts steps:
1) I create a FB:
FUNCTION_BLOCK my_FB
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
myBit AT %Q*: BOOL;
END_VAR
2) Declaration in program:
PROGRAM PLC_PRG
myArray : ARRAY [0..7] OF my_FB;
END_VAR
3) In VAR_CONFIG:
VAR_CONFIG
PLC_PRG.myArray[0].myBit AT %QX0.0 : BOOL;
PLC_PRG.myArray[1].myBit AT %QX0.1 : BOOL;
.....
PLC_PRG.myArray[7].myBit AT %QX0.7 : BOOL;
END_VAR
My questions is: if I need PLC_PRG.myArray[5].myBit , how do I call this into my_FB?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2015-11-09
Originally created by: scott_cunningham
You have define myBit as a local variable of myFB and so you cannot reach it from PLC_PRG. You need to add something to myFB to tell it to adjust the local var (like method TurnON)... You can also assign a global variable to the output - but this will be frowned upon by some programmers.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm trying to use VAR_CONFIG and I'm doing the nexts steps:
1) I create a FB:
FUNCTION_BLOCK my_FB
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
myBit AT %Q*: BOOL;
END_VAR
2) Declaration in program:
PROGRAM PLC_PRG
myArray : ARRAY [0..7] OF my_FB;
END_VAR
3) In VAR_CONFIG:
VAR_CONFIG
PLC_PRG.myArray[0].myBit AT %QX0.0 : BOOL;
PLC_PRG.myArray[1].myBit AT %QX0.1 : BOOL;
.....
PLC_PRG.myArray[7].myBit AT %QX0.7 : BOOL;
END_VAR
My questions is: if I need PLC_PRG.myArray[5].myBit , how do I call this into my_FB?
Originally created by: scott_cunningham
You have define myBit as a local variable of myFB and so you cannot reach it from PLC_PRG. You need to add something to myFB to tell it to adjust the local var (like method TurnON)... You can also assign a global variable to the output - but this will be frowned upon by some programmers.