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

SysFileOpen not working

necati
2023-08-09
2023-08-10
  • necati - 2023-08-09

    Hi,

    I have a text file at location "D:\temp\startup". When I try to open the startup file as shown attached figure, file open function returns "FFFFFF.." value? If you have any suggestion for solving problem, could you please help me?

    BR
    Necati.

     

    Last edit: necati 2023-08-09
  • TimvH

    TimvH - 2023-08-09

    Most likely you use a Runtime of SP19 or higher, because starting from this version the default setting is that only access to files in the PLC folder are allowed. This is for security reasons.

    You can allow the runtime to access files outside of this folder, but you have to modify the CODESYSControl_User.cfg. For the exact file name and it's location, see: https://faq.codesys.com/display/CDSFAQ/Location+of+the+configuration+file
    Or ask the vendor of your PLC.

    One option is to set the IecFilePath, but this limits it to only one folder. More flexible is to use placeholders similar to what you can find in the following link:
    https://faq.codesys.com/display/CDSFAQ/SysFile%2C+Persistence+Manager%2C+Datalog+Manager

    An example + more information which I got from the CODESYS support team when I had the same question:
    **
    [SysFile]
    PlaceholderFilePath.1=C:\tmp, $TMP$
    PlaceholderFilePath.2=C:\IEC, $IEC$
    PlaceholderFilePath.3=E:, $USB$
    PlaceholderFilePath.3.Volatile=1
    PlaceholderFilePath.3.View=1
    PlaceholderFilePath.4=F:, $USB2$
    PlaceholderFilePath.4.Volatile=1
    PlaceholderFilePath.4.View=1

    To make the placeholder visible in the "Device/Files" window, the view attribute must be set.
    The volatile attribute is especially important for Linux-like systems, because here newly inserted disks are mounted in directories.

    You can simply assign placeholders for additional drives in Windows and use them from IEC.

    The inclined IEC developer then writes
    sUsbDir : STRING := '$$USB$$';
    sUsbDir2 : STRING := '$$USB2$$';
    (with double dollar signs).

    And the smart CODESYS programmer then uses, with the above configuration, either
    sBaseDir : STRING := 'C:\IEC';
    or
    sBaseDir : STRING := '$$IEC$$';

    Both will then work.
    **

     
    πŸ‘
    2
  • necati - 2023-08-10

    As you mentioned, I have SP19 Patch 1. Your method worked successfully.
    Thanks for your detailed explanation. 😊😊😊😊

    BR.
    Necati.

     

Log in to post a comment.