Library for settings files

kislov
2020-10-22
2020-11-02
  • kislov - 2020-10-22

    Hi.
    I need to write/read simple settings files with content like NAME=VALUE.
    I know about Recipe Manager, CAA File etc. - so I can solve it with different methods.
    But I want to try find ready simple solution.

    I check CmpSettings, but seems like it works only with CODESYSControl.cfg.
    Is this a way to use it for my files?

    I also check CAA Settings, but seems like it's not implemented in runtime.

    Or maybe I missed some another lib?

     
  • kislov - 2020-10-29

    Still interesting in any advices.

     
  • kallileo - 2020-11-01

    I do something similar to what you describe.
    My HMI with Codesys Soft PLC doesn't have user memory to save persistent variables.
    So I save the value of the variable but not the name in a text file and load it when the system boots. It works great.

    To do this I use the CAA.File library

    https://help.codesys.com/webapp/idx-CAA_FILE-lib;product=CAA_FILE;version=3.5.15.0

    The included code examples help a lot.

     
  • kislov - 2020-11-01

    Yes, I know about CAA File and I can write wrapper for my task.
    But it's not the simplest deal.
    So I hope to find ready solution.
    CmpSettings seems like exactly what I need, but I can't see a way to use it for custom files (only for CODESYSControl.cfg)

    I can't understand the reason - I think, it will be fine to add input sFile to functions of this lib.

     
  • dkugler - 2020-11-01

    easiest and fastest solution is to wrap the data in a structure and write/read this struct data as bin file:
    fbFileWrite_Inst(
    sNetId:= '',
    hFile:= Filehandle,
    pWriteBuff:= ADR(ProduktDaten),
    cbWriteLen:= SIZEOF(ProduktDaten),
    bExecute:= TRUE,
    tTimeout:= T#5s,
    bBusy=> ,
    bError=> ,
    nErrId=> udiFileWriteErrorId,
    cbWrite=> udicbWrite);

     
    • kislov - 2020-11-02

      In my case I need text files because operator must be able to edit it on his PC.

       

Log in to post a comment.