// Title:            FIFO

    // Comment/Function: Shift the data to  FIFO

    // Library/Family:   

    // Author:           DDA

    // Tested with:      V1.6.2 SP1

    // Engineering:      Lib_Dang

    // Restrictions:     ENO disabled - error handling done with error and status

    // Requirements:     PLC (AM610_AM400)

    //-------------------------------------------------------------------------------

    // Change log table:

    // Version  | Date       | Expert in charge       | Changes applied

    //----------|------------|------------------------|------------------------------

    // 09.00.00 29.7.2021  dangguodong

    // the index the of array must be start with the zreo                  

    //==================================================================================




// Check the param

IF Contianer=0

   OR arrayLenght<=0

   OR elementBytes<=0

   THEN

   FC_FIFO_V1:=FALSE;

RETURN;

END_IF;


   // put the pointer to the array , according of the first pointer

FOR i:=arrayLenght-2 TO  0 BY -1 DO

       

  pointerArray:=Contianer+ INT_TO_DWORD(i*elementBytes);

  pointerArrayNext:=Contianer+ INT_TO_DWORD((i+1)*elementBytes);       

BMOV(pbyDataSrc:=ADR(pointerArray^), uiSize:=INT_TO_UINT(elementBytes) , pbyDataDes:=ADR( pointerArrayNext^));


END_FOR


FC_FIFO_V1:=TRUE;