File Operation Problem

mdagci
2023-06-07
2023-06-09
  • mdagci - 2023-06-07

    Hello everyones,

    I create an application for Wago PLC with Codesys 3.5. And I am trying to store the results in .txt file. When I work in Simulation mode, I can save the file directly to the path where I want. But when I work with the PLC just I can save internal memory. The PLC is connected to company network and when I want to save to the server I have to enter login informations but I couldn't find how can I add the code these informations.

    PLC : 750-8212/0XX-001 PFC200
    Lib : sysFile

     
  • TimvH

    TimvH - 2023-06-09

    As the Wago PLC has a Linux OS, I think this might be possible by "mounting a shared folder". This is not CODESYS related, but more a question of giving a Linux device access to this shared folder on the server.

    I have done something similar with another PLC with the following commands (I really don't know if this will work on the Wago PLC, but you could try):

    mount -t cifs -o username=<name>,password=<password>,domain=<domain_name> //<ip_address>/<shared_folder> /home/admin/networkshare
    

    So first you give Linux information about accessing the shared folder. Then at the end, give a reference to the folder in the Linux OS which for CODESYS is the "local folder" representing the network folder.

    If you want to mount this automatically when the PLC starts up, you can add the following line to the fstab file (Google it to get more information about this)

    //<ip_address>/<shared_folder> /home/admin/networkshare cifs username=<name>,password=<password>,domain=<domain_name>
    

    If this all works in Linux, you should be able to open a file on the server in CODESYS:
    hHandle := SysFileOpen('/home/admin/networkshare/....

     

    Last edit: TimvH 2023-06-09

Log in to post a comment.