Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: RBPLC on April 04, 2020, 07:51:19 PM
-
See attached for reference. I'm using V900-V989 in this program and these variables have assigned nicknames. Why when I use the Element Picker do these variables show up as not in use? For example, V900 is selected and you can see its nickname in the top of the element picker box but down at the bottom, there is no "x" in the V900 box.
-
I believe nicknames do not confer use. You can start building a program by naming all the variables you intend to use and none of them are shown as used until a rung references them.
-
Are they being referenced indirectly?
-
These specific ones are being referenced indirectly. I guess that's why they're not showing up as in use. It would be nice if they did.
-
These specific ones are being referenced indirectly. I guess that's why they're not showing up as in use. It would be nice if they did.
Do you mean via an array reference? Or other mechanism (e.g. HMI or remote PLC or ? ? ?)
-
For example (within DmD), 978 is copied to V15. A Math expression stores a value in V[V15]. Another math expression is used to store a value in V[V15+1] and a comparison is made between V[15] and V[V15 +1]. V memory locations 978 and 979 have values stored in them and are being used, they're just being referenced in Copy and Math commands.
-
For example (within DmD), 978 is copied to V15. A Math expression stores a value in V[V15]. Another math expression is used to store a value in V[V15+1] and a comparison is made between V[15] and V[V15 +1]. V memory locations 978 and 979 have values stored in them and are being used, they're just being referenced in Copy and Math commands.
There is no way to know what is being used when it is indirectly referenced (by array index). The best thing to do is to allocate a memory block to use for data like that.
-
These specific ones are being referenced indirectly. I guess that's why they're not showing up as in use. It would be nice if they did.
But how can DMD enumerate what values the index might take at runtime and flag the referenced registers as used? I guess DMD could allow the programmer wherever there is an indirect reference to manually flag registers that he expects to be referenced.
-
The best thing to do is to allocate a memory block to use for data like that.
That works!
-
Whenever I use an array, I use a memclear in my initialization stages, even if I don't believe I need it. That way it shows up in the picker as used.
-
Thanks for the feedback guys. I like ATU's suggestion of memclear to at least signify that they're possibly being used. I also like the idea of being able to manually select them as Controls Guys suggested.