L'esempio seguente mostra come i valori letti da un file CSV vengono memorizzati nel buffer fornito dall'applicazione per ulteriore elaborazione.
Contenuto del file example.csv con delimitatore specificato come punto e virgola (;):
PNo;PName;PValue;PUnit;Description
1;Velo_Max;1500;rpm;maximum velocity of the motor
2;Velo_Min;100;rpm;minimum velocity of the motor
3;Velo_ManMode_Slow;150;rpm;velocity manual mode slow move
4;Velo_ManMode_Fast;600;rpm;velocity manual mode fast movePROGRAM SR_Example
VAR
  fbRead :FFU.FB_CsvRead;
  xCmdRead :BOOL;
  asCsvTable:ARRAY[0..c_uiNumOfRows-1,0..c_uiNumOfColumns-1] OF STRING(c_uiLengthOfValue);
  stCsvTable: FFU.ST_CsvTable;
END_VAR
VAR CONSTANT
  c_uiNumOfRows :UINT:= 8;
  c_uiNumOfColumns :UINT:= 7;
  c_uiLengthOfValue :UINT:= 20;
END_VAR
fbRead.i_stTableReadValues.pbyTable := ADR(asCsvTable);
fbRead.i_stTableReadValues.uiNumOfRows := c_uiNumOfRows;
fbRead.i_stTableReadValues.uiNumOfColumns := c_uiNumOfColumns;
fbRead.i_stTableReadValues.udiSizeOfTable := SIZEOF(asCsvTable);
fbRead.i_stReadParameter.sDelimiter := ';';
fbRead.i_stReadParameter.etReadMode := FFU.ET_CsvReadMode.AllValues;
fbRead.i_stReadParameter.udiNumOfRow := 0;
fbRead.i_stReadParameter.udiNumOfColumn := 0;
fbRead(
       i_xExecute:= xCmdRead, 
       i_sFilePath:= 'myfiles/Example.csv', 
       i_stTableReadValues:= , 
       i_stReadParameter:= , 
       i_timTimeout:= , 
       q_xDone=> , 
       q_xBusy=> , 
       q_xError=> , 
       q_etResult=> , 
       q_sResultMsg=> , 
       q_stFileInformation=> , 
       q_stCsvWarnValueTruncated=> , 
       xValueTruncated=> );Il buffer fornito dall'applicazione contiene gli elementi letti dal file CSV:
| Indice array | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 
|---|---|---|---|---|---|---|---|
| 0 | PNo | PName | PValue | PUnit | Descrizione | – | – | 
| 1 | 1 | Velo_Max | 1500 | min-1 | velocità massima di | – | – | 
| 2 | 2 | Velo_Min | 100 | min-1 | velocità minima di | – | – | 
| 3 | 3 | Velo_ManMode_Slow | 150 | min-1 | modalità manuale velocità | – | – | 
| 4 | 4 | Velo_ManMode_Fast | 600 | min-1 | modalità manuale velocità | – | – | 
| 5 | – | – | – | – | – | – | – | 
| 6 | – | – | – | – | – | – | – | 
| 7 | – | – | – | – | – | – | – |