Synchronize using libcfg file

In SPEL project, there is a function where you can store settings that are necessary for operating a program and calculated values in a file like a point data.
During operation, the data is stored in the Controller, but is also synchronized with the project on the PC running the RC+ at any time, allowing you to smoothly develop and maintain SPEL projects, and port them to other environments.

When using the library, the required information may vary depending on the device or function being operated. Therefore, we provide the same functionality for files available in any format.
Consider if you wish to retain the following information:

  • Setting files that referenced by functions and devices.
  • Files that stores and references the calculated results of functions and devices.
  • Log files that stores and monitors the operation status of a function or device.

When operating a file with the extension "libcfg" in the Controller, it will be downloaded to the PC side after checking the synchronization when connecting to RC+. There is no limitation to the format.

Example: Example using the libcfg file: Exporting files

Function WriteSettingsToFile(fileName$ As String, … , paramB As Integer)
   Integer iFileID

   iFileID = FreeFile
   ChDisk FLASH                     'Specify the project folder of the Controller
   WOpen "Lib1.libcfg" As #iFileID  'Open with the necessary mode 

   Print #iFileID, "Name: ", name$  'Export the setting type and value

   'Repeat for each parameter.

   Print #iFileID, "ParamB: ", paramB  'Export the setting type and value
   Close #iFileID
Fend

Example:Example using the libcfg file: Reading files

   Function ReadSettingsFromFile(fileName$ As String, ByRef name$ As String, … , ByRef paramB As Integer)
      Integer iFileID
      Integer iPos
      String Buf$

      iFileID = FreeFile
      ChDisk FLASH                     'Specify the project folder of the Controller
      ROpen "Lib1.libcfg" As #iFileID  'Open with the necessary mode

      Line Input #iFileID, Buf$
      iPos = InStr(Buf$, ": ")     'Reads the setting type and value separately.
      name$ = Mid$(Buf$, iPos + 2)

      'Read for each parameter.

      Line Input #iFileID, Buf$
      iPos = InStr(Buf$, ": ")     'Reads the setting type and value separately.
      paramB = Val(Mid$(Buf$, iPos + 2))

      Close #iFileID
   Fend

Use the "UploadFileAfterStop" command when you want to use a specific extension due to the specification of the device you are using. By writing this in the library, the specified file will be read from the Controller after the task is completed. However, the RC+ must be connected for this operation.