Write data to file register bank 1 or 2
This instruction reads the number of words specified by DataNumberOfWords from DataStartAddress and writes it to the File Register Bank 1 or 2 as specified by BankNumber beginning with BankOffset.
Input
Specifies the bank number
Specifies the bank number offset
Specifies start address of data to be written to File Register Bank
Specifies number of word units to be written to File Register Bank
With this function you cannot write data to the FL area (File Register Bank 0), i.e., the variable applied at DataStartAddress must not be located in the FL area.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
awProcessDataToStore: ARRAY [0..10] OF INT:=[-111,111,222,333,444,555,666,777,888,999,1100];
awProcessDataToGet: ARRAY [0..10] OF INT:=[11(0)];
bStoreData: BOOL:=FALSE;
bGetData: BOOL:=FALSE;
END_VAR
If bStoreData changes from FALSE to TRUE, the entire data unit variable awProcessDataToStore (a DUT containing 11 elements) is filled with the data from File Register Bank 2 BankOffset 1000.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 9 ;
NETWORK_BODY
B(B_F,WriteDataToFileRegisterBank!,Instance,22,1,36,7,,?DBankNumber?DBankOffset?DDataStartAddress?DDataNumberOfWords);
B(B_VARIN,,2,20,3,22,5,);
B(B_VARIN,,1000,20,4,22,6,);
B(B_VARIN,,awProcessDataToStore[0],10,5,12,7,);
B(B_CONTACT,,bStoreData,5,2,7,4,R);
B(B_F,Adr_Of_Var_I!,Instance,12,5,19,7,,?D?C);
B(B_F,Size_Of_Var!,Instance,12,7,19,9,,?D?C);
L(1,3,5,3);
L(7,3,22,3);
L(19,6,19,8);
L(12,6,12,8);
L(1,0,1,9);
L(19,6,22,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (DF(bStoreData)) then
WriteDataToFileRegisterBank(BankNumber := 2,
BankOffset := 1000,
DataStartAddress := Adr_Of_Var(awProcessDataToStore),
DataNumberOfWords := Size_Of_Var(awProcessDataToStore));
end_if;