- HMI Model: ANy
- EasyBuilder Pro Version:Latest
Either via CODESYS , or HMI
To a file on a USB stick
Either via CODESYS , or HMI
To a file on a USB stick
Hi @david,
What file type are you trying to write to? Will the HMI need to append data, create a new file, or both?
The file will be created and appended to with strings created as needed
Hi @david,
It should be possible to write ASCII data to a file and then copy this file to a USB using the SysFile and SysDir libraries within Codesys. Here is a link to a Codesys demo project that will write a single string to a file within the PLC and transfer it to a USB: Link. Additional information can be found within the âCODESYS Library SysFile SysDir Demoâ that can be obtained via the demo projects link: Link.
What is the correct format to Address the USB
I tried Creating a directory with
'/David/
worked created on the local HMI
but âUSB:/Davidâ return 1 - failure
but âUSB:/David/â return 1 - failure
the code implied that this should work
âUSB:/PlcLogic/User/Data.txtâ
The âSysDirCreateâ function block is not used to create a directory in a USB drive. It will create a directory to the Codesysâ own memory location (called âSysFileâ). Therefore, do not address the USB when using this function block.
You have to use the âSysFileCopyâ function block to set the USB syntax, such as âUSB:/PlcLogic/User/Data.txtâ