How to handle a CSV file from CODESYS v2 or v3 internal PLC?
What to know
With eTOP500/600 HMI series is possible to create and manage files using CODESYS v2 or v3 internal PLC.
These files can be stored on:
- HMI Flash Memory
- USB Memory
- SD Card
This FAQ will guide you on what to do to be able to manage files from internal PLC.
At the bottom of this FAQ, into Attachment section you will find two example for both internal PLC.
What to do with CODESYS V2
To manage file from CODESYS v2 internal PLC you can use two libraries included into Exor Target Support Package "CoDeSys_JMobile_WCE_Install_Target".
These Libraries can be added to the CODESYS project by:
- Click on "Resources" (1)
- Double-click on "Library Manager" (2)
- Right-click on empty area of Library list (3)
- Select "Additional Library..." (4)
- Select "SysLibFile.lib" (5)
- then click on Open button (6)
If needed, also "SysLibDir.lib" library can be added in the same way.
The "SysLibFile.lib" library contains all following Function Blocks useful to manage files:
File path is relative to the CODESYS V2 Runtime directly on HMI,
this means a file "test.txt" will be searched by default into "\Flash\qthmi\CODESYS\"
Below there are some examples of common path:
- "test.txt" = refer to "Flash\qthmi\CODESYS\"
- "..\test.txt" = refer to "Flash\qthmi\"
- "..\data\test.txt" = refer to "Flash\qthmi\data\"
- "..\..\..\USBMemory\test.txt" = refer to external USB memory
- "..\..\..\Storage Card\test.txt" = refer to external SD Card memory
What to do with CODESYS V3
To manage file from CODESYS v3 Internal PLC you can use two libraries included into CODESYS v3 workbench.
These Libraries can be added to the CODESYS v3 project by:
- Double-click on "Library Manager" (1)
- Click on "Add library (2)
- Expand Use Cases and select "File Access" (3)
- Confirm with OK (4)
The "CAA File" library included with File Access, contains all Function Blocks useful to manage files:
File path is relative to the CODESYS V3 Runtime directly on HMI,
this means a file "test.txt" will be searched by default into "\Flash\qthmi\RTS\"
Below there are some examples of common path:
- "test.txt" = refer to "Flash\qthmi\RTS\"
- "..\test.txt" = refer to "Flash\qthmi\"
- "..\data\test.txt" = refer to "Flash\qthmi\data\"
- "..\..\..\USBMemory\test.txt" = refer to external USB memory
- "..\..\..\Storage Card\test.txt" = refer to external SD Card memory