Jump to content

Case Structure and property nodes


Recommended Posts

i have created a front panel which has an array of booleans indicator, and a numeric input.

My assignment now is to generate a wire diagram that is used to activate individual elements of the away, turning the lights on when the true case is selected, and only one element should be true at any incident.

After that it is to be put into a while loop to be terminated after each loop after wach element of the array has been true at least once.

What I have is a conditional to see if the input number is even, and I have set a build array function outside the cause structure, to build an array. Right now it runs, but it only builds one element of the array each time it runs. Showing in the indicator when it is indexed at 0 and the input is even.

I am guessing that there needs to be a loop to continuously feed a variable in thru the conditionals, or to have one input compared against three conditionals..

Here is what I have done so far...

can someone give me a starting point

Link to comment

Firstly, a caution. Most LAVA folks don't take kindly to be asked to do someone's homework assignment for them. However you seem to have at least made an effort to get somewhere which is better than most...

You might want to think about what the effect of raising 2 to the power of your integer and then looking at the binary representaiton of the resultant number might be. A handy way of inspecting the bits of the binary representation of an integer is to use the number to boolean array primitive. Then you might want to read up on shift registers and also on boolean operations as a way of latching a boolean value to true.

QUOTE (MicrochipHo @ May 5 2008, 05:57 PM)

i have created a front panel which has an array of booleans indicator, and a numeric input.

My assignment now is to generate a wire diagram that is used to activate individual elements of the away, turning the lights on when the true case is selected, and only one element should be true at any incident.

After that it is to be put into a while loop to be terminated after each loop after wach element of the array has been true at least once.

What I have is a conditional to see if the input number is even, and I have set a build array function outside the cause structure, to build an array. Right now it runs, but it only builds one element of the array each time it runs. Showing in the indicator when it is indexed at 0 and the input is even.

I am guessing that there needs to be a loop to continuously feed a variable in thru the conditionals, or to have one input compared against three conditionals..

Here is what I have done so far...

can someone give me a starting point

Link to comment

QUOTE (MicrochipHo @ May 5 2008, 02:25 PM)

i have created a front panel which has an array of booleans indicator, and a numeric input.

My assignment now is to generate a wire diagram that is used to activate individual elements of the away, turning the lights on when the true case is selected, and only one element should be true at any incident.

After that it is to be put into a while loop to be terminated after each loop after wach element of the array has been true at least once.

What I have is a conditional to see if the input number is even, and I have set a build array function outside the cause structure, to build an array. Right now it runs, but it only builds one element of the array each time it runs. Showing in the indicator when it is indexed at 0 and the input is even.

I am guessing that there needs to be a loop to continuously feed a variable in thru the conditionals, or to have one input compared against three conditionals..

Here is what I have done so far...

can someone give me a starting point

For those of you turned off by my sparse program, i took out the build array function attached to a boolean constant inside the case structure, because I realized that wasn't correct.

You need to know that things wired to the outside of a loop for input are read only once. And the output of a loop is only sent once when the loop is completely completed and stopped.

So your control to direct the lights must be inside the loop to have any effect on the other things inside loop while it is running. In the simplest case it is like the loop becomes a world all by itself while it is running. Also if you wish to have the indicator update more than once it must also be within the little world of the poop.

You can represent the pattern of lights many ways. You have choese a numeric control so you are "encoding" the light condition as a number. You could do it with strings, or with an array of booleans like the output, and so on. However you have not said exactly how to decode the numeric input. I give you an example that shows two simple but different ways to decode the numeric control. The first is a simple conversion from number to boolean array. The second is to use a case statement to select a particular pattern of booleans for the output. Notice that the Case structure is not always true and false, in the example the cases are 0. 1. 2. 3. etc. If you wire different types inputs to the contidional terminal of the case structure you get different function for the case structure. Many VI's is are flexible this way - is is called polymorphic function.

It is a surprise to me that you have no been tought these basic things in your class.

Mike

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
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.