LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cluster whith while and case

Solved!
Go to solution

Hi,

I am currently making a program to get data of a weather station and display it in a cluster. So far the program gets the hexadecimal data, converts it to a decimal array and reads the array. The problem is that to read the array i have to search the data rought it with a case structure inside a while loop and at each loop interation de data that have been displayed in the cluster returns to 0. I tried to put the cluster inside and outside of the while loop, with and without shift register as well as bundle the data in the case strcture and unbundle it and sent to the cluster outside of it. I really can´t understand what it is that i am doing wrong. Here below is an example of the hexadecimal data:

91FF FF06 0030 0266 164A C500 0006 C7FF FF00 0072 0100 0020 0091 FFFF 0000 7201 0000 2000 91FF FF0E 020E FFFF 0600 3102 6616 4AC5 0000 06C8 FFFF 0000 7201 0000 2000 91FF FF00 0072 0100 0020 0091 FFFF 0000 7201 0000 2000 91FF FF06 00

Thanks

Download All
0 Kudos
Message 1 of 9
(2,879 Views)

did you put your cluster between the case structure and while loop borders?

estação%20meteorológica[1]_BD.png

0 Kudos
Message 2 of 9
(2,870 Views)

Yes, but the result kept the same

0 Kudos
Message 3 of 9
(2,864 Views)

It's your algorithm.....probe your data lines and keep the cluster indicator as suggested, otherwise you will not see the data until you exit the loop

0 Kudos
Message 4 of 9
(2,852 Views)

First you have to put the cluster indicator between the case structure and the while (as Apok suggested) so it is updated after each iteration of the while loop (it gets more difficult if you want the values to be updated as soon as they are changed). One of the problems is that the your while loop is running full speed so you can't see any changes on the front panel and at the end the final case (value = 0) reset the values that where changed to 0.

 

If you add a 1 sec delay in the while loop you will see that some of the values are updated.

 

Ben64

0 Kudos
Message 5 of 9
(2,825 Views)

First thank you all for the help.

What i can´t understand is why the program resets all values to 0. Apok said the problem is my algoithm, but i can´t see where is this problem. Is it how the while loop works?

The purpose of the program is to get the data from de wheather station every one minute and update the data on the front panel.

 

0 Kudos
Message 6 of 9
(2,789 Views)

You are exceeding an array index so the default value of 0 is used. Note that the index of the first element of an array is 0 so if the array size is 184 the index of the last element is 183. In the following image, using the hex input you wrote in a previous post, the constant value 4 is added to an input value of 180 (that is in case 6) and then you add the for loop index so you are indexing an array with a value exceeding the array size so it returns 0.

 

Ben64

 

 

estação_meteorológica_BD.png

Message 7 of 9
(2,773 Views)
Solution
Accepted by topic author heitorwwa

there are reaaaaaaally neat tools called, breakpoint,step into, step over,probes, retain last values....if you use them, you will see what we see   Smiley Wink

Message 8 of 9
(2,769 Views)

Sorry for not answering before, but thanks for the help, all of you. I can see the problem now!Smiley Happy

0 Kudos
Message 9 of 9
(2,732 Views)