Define the FIFO buffer area
This FP instruction specifies the starting area d_Start for the FIFO (First-In-First-Out) buffer and the memory size n_Words of the FIFO buffer.
Input
Specifies the memory size of the buffer
Values: 1–4096
Output
Starting data area of the buffer
Format of data buffer
if a value specified for a parameter is outside the permissible range.
if a value specified for a parameter is outside the permissible range.
Corresponding F instructions: F115_FIFT
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
bDefineBuffer: BOOL:=FALSE;
dutTestError: BOOL32_OVERLAPPING_DUT;
iWords: INT:=8;
arrFifo: ARRAY [0..11] OF INT:=[12(0)];
END_VAR
When the variable bDefineBuffer is set to TRUE, the function is carried out.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 7 ;
NETWORK_BODY
B(B_F,E_NE!,,13,2,19,7,,?DEN?D?D?AENO?C);
B(B_VARIN,,iWords,11,4,13,6,);
B(B_VARIN,,arrFifo[0],11,5,13,7,);
B(B_VAROUT,,dutTestError.b0,19,4,21,6,);
B(B_CONTACT,,bDefineBuffer,5,3,7,5,);
B(B_COMMENT,,Check the Buffer size,2,1,13,2,);
L(7,4,13,4);
L(1,4,5,4);
L(1,0,1,7);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_F,FP_FIFO_DEFINE!,,13,1,22,5,,?DEN?Dn_Words?AENO?Cd_Start);
B(B_VARIN,,iWords,11,3,13,5,);
B(B_VAROUT,,arrFifo[0],22,3,24,5,);
B(B_CONTACT,,bDefineBuffer,5,2,7,4,);
L(7,3,13,3);
L(1,3,5,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (bDefineBuffer) then
FP_FIFO_DEFINE(n_Words := iWords, d_Start => arrFifo[0]);
(* Check the Buffer size *)
dutTestError.b0 := arrFifo[0] <> iWords;
end_if;