Clear DRAM without restart

That’s definitely a situation I’ve seen before! Unfortunately, I don’t think there is a solution that doesn’t involve modifying the code in some way. This is especially true if some of the latched variables are global, as those are not tied to a single program.

This is just my opinion, but I recommend taking the time to understand what’s happening in the code and refactoring it into something more modular (especially if you plan to use it in other places). You don’t necessarily have to rewrite the whole thing, but anything that can be latched should also be easily unlatched with a command. A couple of ideas for this (based on the previous posts):

  • Create a Command/Parameter/Status structure that can be used by other programs to view and control this program, including resetting anything that you want to be resettable
  • Moving all of the code into a function/function block and clearing all of your outputs/internal variables when the function isn’t executing

It’s great to have a program you know works without changes…until you need to change it and don’t remember how it works. If you have any questions about code organization, I’m sure plenty of people on the Community would be happy to help as well!