Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Make retain structure element non-retain

zorgoz
2017-02-13
2017-02-14
  • zorgoz - 2017-02-13

    Hello,

    I have arrays of quite large structures (which I can not split). I need half of the structure fields to be RETAINed, but half of them not. If I put the variables in retain area, I am running out of retain memory. I know about {nonpersistent} pragma, but it is for PERSISTENT and not RETAIN storage.
    Is there any similar mechanism that makes it possible to exclude some fields form being retained, thus leaving space for others?

    Thank you

     
  • shooter - 2017-02-13

    the only way is by putting a structure in retain and copy them into another bigger structure (not retained) however you will need to copy them back into the retained structure for the ones you have to save.
    do this only when they are changed.

     
  • Anonymous - 2017-02-14

    Originally created by: scott_cunningham

    The whole idea of a structure is a list of data items occupying a zone of memory - an array of bytes divided up into various variables. What your hoping for is to break up that ordered memory and say elements x,y and z are stored over here, and a,c,e are over here and b is over here.

    Option 1 a copy in/out as suggested.

    Option 2 You may too far in to adjust, but I think your structure should be different. Maybe you can change the structure elements that need to be retain to be pointers, so you can assign to retain space.

    Option 3 different hardware with more retain.

     
  • zorgoz - 2017-02-14

    Thank you for your suggestions.

     

Log in to post a comment.