04-14-2015 09:57 AM - edited 04-14-2015 10:06 AM
Hi hun,
you DID NOT include any meaningful data in your VI ("positions").
As you divide by an array size of zero your VI tries to create an array of size 2^31-1 DBL elements…
AGAIN:
Attach the VI with meaningful data in it!
And please explain (in detailed manner) how you want your pulses be generated!
(Running your VI with two "Position" values takes just milliseconds here…)
04-14-2015 10:09 AM
That is really odd Gerd,
I DID fill the inputs with data, no idea why they get lost when attaching the file! I'll try attaching the new version now...
Anyway I think I solved the memory problem now by using INT16 for the encoder outputs (I guess I could use INT 8 as well).
Cheers
04-14-2015 10:19 AM - edited 04-14-2015 12:35 PM
After filling in data into relevant controls, you need to make the new values the default before saving. Do you know how to do that?
From a a quick glance at the code, you seem to exclusively deal with integers (except for the time and position control before multiplication). So why is there so much orange in the code??
Instead of "Insert into array", use "built array"".
The inner FOR loop is identical in the two cases, thus it belongs after the case structure. Only one instance needed.
The small case structure is useless, you automatically get zero if you index outside the valid range. Delete it and keep only the default code.
The outer loop needs to be a FOR loop because the number of iterations is known before the loop starts.
04-14-2015 12:30 PM
What are typical inputs for "time" and "amplitude"?
04-14-2015 04:34 PM
Check out the In Place Element Structure.
04-14-2015 04:51 PM
04-15-2015 02:52 AM
Hi Altenbach,
thank you very much for all the tips, I will take them into account and update my code! It's always nice to learn some new things from the pros.
About the "orange", I can't get rid of it completely as the input array "Position" comes from another module and is in DBL format, and also when performind some divisions which don't throw integer results I have to deal with DBL variables.
Typical values for time are 5 to 20 seconds and amplitude will be 5, 12, or 24.
04-15-2015 03:04 AM
thehun wrote:About the "orange", I can't get rid of it completely as the input array "Position" comes from another module and is in DBL format, and also when performind some divisions which don't throw integer results I have to deal with DBL variables.
Yes, I noticed that. Here's a rewrite keeping approximately the original functionality. Maybe it can give you some ideas. THere are probably bugs.
04-15-2015 10:08 AM
Thanks, it definitely does!
04-16-2015 07:32 AM
@thehun wrote:
Thanks, it definitely does!
Have bugs? In Christian's code? The requirements must be wrong!