10 Replies Latest reply on Jun 5, 2020 2:43 PM by HeLa_4671121

    How to save to a variable to memory and recall it after a power cycle

    HeLa_4671121

      Hello-

       

      I'm new to the PSoC world and I need some help.  I have a program that has two timing variables that I can change through the mini-USB UART port while the program is running (with Putty).   What I would like to do is be able to save the changes to a memory location so that when the power is recycled, the PSoC recalls the last saved value.  The only user communication connection to the PSoC will be the mini-USB.

       

      I'm using the following kit:  CY8CKIT-059 5LP

       

      Using two variables to control the length of time for CyDelay within a function. 

       

      uint32 ftime =(3000);   //3 Sec default - Variable #1
      uint32 btime =(3000);  //3 Sec default - Variable #2

       

      I'm using a switch statement to be able to vary these timings anywhere from 1 - 5 secs depending on user preference.

       

      I'm using the uint32 because that is data type that the CyDelay wanted.  What would be the easiest way to do this?  I've looked at both em_EEPROM and Flash but I'm too unexperienced to figure it out.  My program is also printing status updates to the USB port.  Is it possible to display the recalled value on the USB port?  Attached is my project, please be kind as this is my first time working with PSoC and writing C code .  If anyone has example code or wants to tweak mine, it would be greatly appreciated.  

       

      Thank you,

      Henry