Jump to content

Data flow programming


alphaone

Recommended Posts

Hi everybody, as we all know, Labview is a data-flow programming language,everything must "flow in" from left and "flow out" to the right. I can't convert this programming style from general language. Here is an example that add 1 to itself.

in C. the code is :number += 1;

in lv,it looks like the following picture.

I feel it's so bad, but I have no other way.

:(

Somebody can bring me a new idea?? Thanks.

post-2988-1127804234.jpg?width=400

Link to comment
Hi everybody, as we all know, Labview is a data-flow programming language,everything must "flow in" from left and "flow out" to the right. I can't convert this programming style from general language. Here is an example that add 1 to itself.

in C. the code is :number += 1;

in lv,it looks like the following picture.

I feel it's so bad, but I have no other way.

:(

Somebody can bring me a new idea?? Thanks.

The C notation number += 1; basically is short notation for number = number + 1; So the LV diagram is not that different from C here.

The diagram you posted can be simpler. Loose the sequence, it's not necessary (dataflow). Also, you can get rid of one local in this particular example.

post-906-1127805697.gif?width=400

Whether or not you need the second local havily depends on the context in which you would be doing this operation. Most of the time you will be operating on data in shift registers or results from sub-vi's and displaying those in an indicator. No locals needed there.

Learning moment: stop thinking in variables, the 'variable' is the wire!!

Link to comment

Thank Michael and jeffreyhabets.

I think what confused me is how to convert the conventional progromming methodology to the LV's.

Sometimes I found it's so urgly and reduntent if I change a value of an array by using "Replace Array Subset" that input an array by value and must connect output to an other array. So ,just like this simple example ,i have to use 2 locals.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.