Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Using the filesystem?

2014-02-21
2014-02-21
  • urbanlarsson - 2014-02-21

    Hi!

    Im a newbe on both codesys and Linux, is there any function for Reading/Writing files to the memorycard?

    I want to use the card for config-files and logging.

    /U

     
  • Moderator3S

    Moderator3S - 2014-02-21

    Hi Urban,

    the steps are:

    download the file utilities example from the store.
    Then as usually the procedure is open it from

    "c:\Users\<your user="" name="">\CODESYS Examples\File Utilities\FileUtilities.project" </your>

    rightclick on the plc device and update the plc to raspberry pi device.. and update whole project to actual Compiler
    settings etc...
    Then you need the path settings to your demands:

    PROGRAM SystemFile
    VAR
    ( The file names can be adapted )
    szFileName : STRING(128) := '/home/pi/Test.txt';
    szFileNameCopy : STRING(128) := '/home/pi/TestCopy.txt';
    szPathName : STRING(128);

    PROGRAM SystemDir
    VAR
    ( The file names can be adapted )
    sDirName : STRING:= '/home/pi/delete';
    sFirstFileName : STRING:= '/home/pi/firstTest.txt';
    sSecondFileName : STRING:= '/home/pi/secondTest.txt';
    sThirdFileName : STRING:= '/home/pi/thirdTest.txt';

    PROGRAM CAA_File
    VAR
    ( The file names can be adapted )
    sFileName : CAA.FILENAME := '/home/pi/CAAFile.txt';
    sFileNameCopy : CAA.FILENAME := '/home/pi/CAAFileCopy.txt';

    PROGRAM CAA_Dir
    VAR
    sDirNewName : CAA.FILENAME:='/home/pi/NewDirectory'; ( This path can be adapted )
    sDirNextName : CAA.FILENAME:='/home/pi/NextDirectory'; ( This path can be adapted )
    sFileName : CAA.FILENAME:= 'Test.txt'; ( The name for the file to be created )

    BR

     

Log in to post a comment.