Codesys #21: Retain & Persistent variables

Поделиться
HTML-код
  • Опубликовано: 25 июл 2024
  • In this video you will learn the basics of remanent variables in Codesys.
    You will learn how to make a variable retain or persistent, when you want to keep the value of a variable in case of a uncontrolled termination such as poer loss of a PLC or when you want to do some changes in your program.
    At the end you will also get information about constant variables in codesys programming.
    =============================
    ⌚Timestamps:
    00:00 - Intro
    00:37- what is remanent variables
    03:03 - Retain variables
    05:10- Persistent variables
    12:12- Constant variables
    =============================

Комментарии • 8

  • @carlosgallego1076
    @carlosgallego1076 4 месяца назад +1

    Thanks for the video

  • @user-ew9pi5lf6t
    @user-ew9pi5lf6t 4 месяца назад +1

    Can you verify what happens with the persistent variables when you upload your CODESYS configuration via a Boot Application (not a simulation or direct download)? From my experience, when uploading with a Boot Application, the variables do not retain.

    • @industrial_automation
      @industrial_automation  4 месяца назад

      Hi,
      No it should work with boot application because a copy of the application will be stored in the target device (PLC or any controller like Raspberry Pi). I tested this with a Festo PLC. What I've done: Create a project and the persistent variable like in my Video. Create a boot application. Change the values. Power on and off. (Even I closed the codesys and then restarted it). --> The values are retained.

    • @user-ew9pi5lf6t
      @user-ew9pi5lf6t 4 месяца назад +1

      @@industrial_automation thanks for replying! When you uploaded with a boot application, you didn't download the project to the PLC/Device before that? You only used the Boot Application to send the project across? I'm away on holiday at the moment, but when I'm back in front of my demo rigs, I'll try it with your method and see if it resolved the issue I have with persistence variables not retaining when using Boot Applications. Hopefully it does!

    • @industrial_automation
      @industrial_automation  4 месяца назад

      @@user-ew9pi5lf6t I did the download. Even I changed some part of code and downloaded the changes. It works. (Be carefull just not to change the persistent variables. If you change them the values will be lost)

    • @user-ew9pi5lf6t
      @user-ew9pi5lf6t 4 месяца назад

      @@industrial_automation if you tried this by directly downloading the program into the device via ethernet, then that's masking the problem I'm talking about. Try a brand new program, brand new device with no program installed. Create a new codesys project with persistence variables, and then create a boot application. Add the program to your device via the boot application (not ethernet). You may find the problem I'm talking about with the presence channel files not being transferred across within the .app and .crc files.

    • @user-ew9pi5lf6t
      @user-ew9pi5lf6t Месяц назад

      @@industrial_automation yeah, this method doesn't work if you only use the Boot Application method to transfer your project across (i.e. laptop NOT connected to PLC). You'll notice within the PlcLogic folder that the ac_persistence folder is missing. It only transfers across when you perform a direct download (i.e. laptop connected to PLC).