I use the function SysFile.SysFileOpen(sFileNamePara, SysFile.ACCESS_MODE.AM_WRITE, pErrorFileOpen); to open and write a file.
Since the update from Codesys V3.5 SP17 to V3.5 SP19 Patch 5 it does not work anymore. I first had SysFile.SysFileOpen(sFileNamePara, SysFile.ACCESS_MODE.AM_APPEND_PLUS, pErrorFileOpen); in both versions.
hFile_Test is a pointer to byte. It gives an exceptional error when dereferencing the hFile_Test pointer.
At 19.1 the hFile_test should be RTS_IEC_HANDLE and always open-write - close in one cycle
udi_handle:RTS_IEC_HANDLE;//handle-number. Is created by SysFileOpenudi_handle:=SysFileOpen(sFileName,Sysfile.AM_WRITE_PLUS,ADR(udi_ErrorCode));udi_RetValWrite:=SysFileWrite(udi_handle,pRemBuffer,szRemBufSize,ADR(udi_ErrorCode));//closing file IFudi_RetValWrite<szRemBufSizeTHENui_Error:=cWriteError;END_IF//error writing dataudi_ErrorCode_Close:=SysFileClose(udi_handle);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I use the function SysFile.SysFileOpen(sFileNamePara, SysFile.ACCESS_MODE.AM_WRITE, pErrorFileOpen); to open and write a file.
Since the update from Codesys V3.5 SP17 to V3.5 SP19 Patch 5 it does not work anymore. I first had SysFile.SysFileOpen(sFileNamePara, SysFile.ACCESS_MODE.AM_APPEND_PLUS, pErrorFileOpen); in both versions.
hFile_Test is a pointer to byte. It gives an exceptional error when dereferencing the hFile_Test pointer.
Edit: I use Codesys on a Raspberry pi
Last edit: kleeswi 2024-02-19
At 19.1 the hFile_test should be RTS_IEC_HANDLE and always open-write - close in one cycle
Finally this solved my issue: https://forge.codesys.com/forge/talk/Engineering/thread/3da9ded84e/, and the official documentation https://faq.codesys.com/display/CDSFAQ/SysFile%2C+Persistence+Manager%2C+Datalog+Manager . Add the media folder to the PlaceholderFilePath. Like this:
PlaceholderFilePath.2=/media/pi, $usb$
PlaceholderFilePath.2.View=1
PlaceholderFilePath.2.Volatile=1
Last edit: kleeswi 2024-02-19
But thank you!
Last edit: kleeswi 2024-02-19