07-13-2009 04:59 PM
Hi,
I am tring to use formula node with global variables as an input and output,
but this is where I see the SW hangs forever.
By the way I am a novice to the labview.
Can some give me hint why this is happening?
Thank you in advance,
Do
Solved! Go to Solution.
07-13-2009 05:04 PM
Oh my... Have a little text-based programming in your background, do we?
Definitely not the way to code LabVIEW. What are all those global variables for?
07-13-2009 05:11 PM
As you may have guessed from the formula node program, some of the variables are
the reference to arrays and I was trying to imitate the header file in C, so that
I can reference these informations from other subVI.
By the way this is not a optimum way to implement in the Labview.
Any idea why it is hanging?
Using the "highlight execution" option I can trace the input as they come in, but I do
not see any activities on output side?
What is going on?
Thanks,
Do
07-13-2009 05:17 PM
WTF? I think you have try to learn LabVIEW 😄
You can beginn with a hello-world-tutorial...
Sorry for my expressive behaviour.
07-13-2009 05:35 PM
07-13-2009 05:55 PM
Thank you for your reply.
Here is a For loop structure in my formula node.
By the way I did not think the formula node had this much of slowness.
Thanks for your information.
So if I were to use the Labview structure, should I directly translate
this structure to "For" and "case" structure?
Is there any way I can perform this with less complicated way?
Thank you in advance,
Do
for(i=0; i<6;i++)
{
for(j=0; j<9; j++)
{
....
}
}
....
for(i=0; i<6;i++)
{
for(j=0; j<9; j++)
{
....
}
for(j=0; j<128; j++)
{
....
}
}
07-13-2009 10:37 PM
Well, the first case of the two loops has a direct LabVIEW translation like this:
However, just because that's the direct translation doesn't mean that's what you should be doing. In the formula node it seems as if you were copying elements from one array to another. Element-wise operation on arrays via loops can be quite inefficient in LabVIEW. Often one can operate in place with arrays, and an operation that would require two loops in a language like C would actually require no loops in LabVIEW. In fact, with the above example, even if you were to use loops, arrays can auto-index for-loops so you don't even need to wire the constants to the N terminals to tell the loop(s) how many times to run.
Can you describe what you're trying to accomplish? There's likely to be a more natural way to do it in LabVIEW that would require no loops. Have you gone through the tutorials? You can also look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.
07-14-2009 11:53 AM
Hi,
Thank you very much for your information.
I figured out way it was hanging in my formula node.
One of the inner loop count was going from 0 to 128 and it was declared as "int8" which
was one bit short than "int8" declaration can handle, and that was why it was going
into infinite loop. Once I changed to "int16", it worked fine for me.
By the way I took the basic online training course, hopefully near future I can
take more advance courses to handle my C background instead of formula node.
Intention of this formula node was to reduce the complication of my LabView. As you indicated and
also read from the web there are some disadvantages relate to performance and memory usage,
but for now I am willing to take it.
That's for now.
I really appreciate your help.
Do
07-14-2009 12:02 PM
As smercurio was mentioning, if you had described what you wanted to do, we could show you tricks that can be done using LabVIEW.
For instance, the For Loops may not be necessary if you are trying to extract or manipulate data within arrays.
It's good that you have it working, but it would be better to learn the power behind LabVIEW. Who knows, you may actually walk away from C-code.. 😉