The idea is that you can define FB with I/O access. If you do that in the standard way
VARSTATEAT%IX0.0:BYTE;...END_VAR
you will not be able to use instances of FBs with different I/Os, because the access to the process image is fixed.
With the VAR_CONFIGs you can leave the implementation of the acccess to the I/Os open to the instances. In the object "Variable_configuration" under the register card "Resources" in the folder "Global Variables" you can the terminate, which instance should use which I/O.
Example: You define an FB with your declarations. You declare two instances of the FB (Inst1, Inst2)
* You terminate which I/Os the instances should access to: Open the "Variable_configuration", mark everything (including the VAR_CONFIG/ END_VAR), call the command under "Insert/All instance Paths" ==>
VAR_CONFIGÂ Â PLC_PRG.inst1.STATEAT%I:BYTE;Â Â PLC_PRG.inst1.DATAINAT%I:WORD;Â Â PLC_PRG.inst1.CTRLAT%Q:BYTE;Â Â PLC_PRG.inst1.DATAOUTAT%Q:WORD;Â Â PLC_PRG.inst2.STATEAT%I:BYTE;Â Â PLC_PRG.inst2.DATAINAT%I:WORD;Â Â PLC_PRG.inst2.CTRLAT%Q:BYTE;Â Â PLC_PRG.inst2.DATAOUTAT%Q:WORD;END_VAR
Now you can write the specific address in it. E.g.
VAR_CONFIGÂ Â PLC_PRG.inst1.STATEAT%IB0:BYTE;Â Â PLC_PRG.inst1.DATAINAT%IW10:WORD;Â Â PLC_PRG.inst1.CTRLAT%QB0:BYTE;Â Â PLC_PRG.inst1.DATAOUTAT%QW10:WORD;Â Â PLC_PRG.inst2.STATEAT%IB1:BYTE;Â Â PLC_PRG.inst2.DATAINAT%IW11:WORD;Â Â PLC_PRG.inst2.CTRLAT%QB1:BYTE;Â Â PLC_PRG.inst2.DATAOUTAT%QW11:WORD;END_VAR
I hope this will explain you the function
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello all:
I had see a example ,the variable define like:
VAR
STATE AT %I: BYTE;
DATAIN AT %I: WORD;
CTRL AT %Q: BYTE;
DATAOUT AT %Q: WORD;
END_VAR
My question is "%I*" ???What is it mean???
This is the so called VAR_CONFIG.
The idea is that you can define FB with I/O access. If you do that in the standard way
you will not be able to use instances of FBs with different I/Os, because the access to the process image is fixed.
With the VAR_CONFIGs you can leave the implementation of the acccess to the I/Os open to the instances. In the object "Variable_configuration" under the register card "Resources" in the folder "Global Variables" you can the terminate, which instance should use which I/O.
Example:
You define an FB with your declarations.
You declare two instances of the FB (Inst1, Inst2)
* You terminate which I/Os the instances should access to: Open the "Variable_configuration", mark everything (including the VAR_CONFIG/ END_VAR), call the command under "Insert/All instance Paths" ==>
Now you can write the specific address in it. E.g.
I hope this will explain you the function
Thank you for your explain!!