Host Engineering Forum
General Category => General Discussion => Topic started by: PLCGuy on July 03, 2018, 06:45:38 AM
-
Is there more info on this subject of Heaps. I am creating and using memory blocks, but do not fully understand the Heaps, etc. So I do not use the tabs.
I am reading the help files but it is just not sinking in. I did find some examples for recipes. Reading over that. Not sure why I am not getting it.
-
Instead of having a named block of structures that you reference by block name and 0-based id, a heap item is just one element, no id. Some PLCs call this a Tag. So instead of a block of 10 or 100 PIDs, you can create a single PID heap item with a well named tag called "MyHeater"
-
Blocks are numbered arrays, heap items are singletons. As Franj said, tags.
Background: The heap was originally created as a place where the system could create elements outside of normal element memory. For instance, if you had a CTRIO module, we needed a place to automatically create the structures associated with it. That worked well, so we made instructions that needed structures (like PID or TASK) do the same thing. Eventually we made it where users could create items there as well.
While the system creates lots of stuff on the heap for me, about the only time I create something directly on the heap is if I need a big string for something like a comm buffer. I usually create a 1024 byte string with a name like CommBuff, rather than a block named SLL0.
The bottom line is that you may never use it directly, and that's fine.