FP_FIFO_DEFINE

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.

Parameters

Input

n_Words (WORD, INT, UINT)

Specifies the memory size of the buffer

Values: 1–4096

Output

d_Start (WORD, INT, UINT)

Starting data area of the buffer

Remarks

Format of data buffer

  1.  (1) Buffer size
  2.  (2) Number of stored data
  3.  (3) Reading pointer
  4.  (4) Writing pointer
  5.  (5) Data buffer area (not cleared)

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if a value specified for a parameter is outside the permissible range.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if a value specified for a parameter is outside the permissible range.

Example

POU header

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

POU body

When the variable bDefineBuffer is set to TRUE, the function is carried out.

LD body

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

ST 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;

Modified on: 2022-07-04Feedback on this pagePanasonic hotline