From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data do not pass through case structure

Jacobier_1-1604104080861.png

Jacobier_2-1604104235989.png

 

I am using shift register to store some data into arrays. There is something wired happen and I could not figure out why. In the first figure, appended array and y32 are connected. However, their value is not the same (see second figure). Can someone tell me why data do not pass through the case structure and how to fix this please?

0 Kudos
Message 1 of 27
(1,839 Views)

It is extremely difficult to find the "mis-wiring" from a picture (a tiny one, at that).  You should attach the actual VI, so that we can "play" with it (I'd straighten out the wires, make sure all are connected, take a look at the "hidden" Case code, make sure I can "see" the functions you are using, etc.).

 

Please attach the actual VI.  [How would you like to debug a picture of a 500-line listing of a C++ program?  Wouldn't you really rather have the .cpp file?]

 

Bob Schor

0 Kudos
Message 2 of 27
(1,831 Views)

You shouldn't expect them to be the same.  "appended array" is inside a case structure, "y 3 2" is outside.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 27
(1,810 Views)

Sorry. I actually circumvented the problem with a very wired solution, although I di not solved it. think the problem could be caused by upper the level VIs, because I saw a strange issue in another VI at the same level as well.  The program is pretty big. Do I need to attach everything?

 

I attached my modified file here. I only changed other places, the place I am confused with remained there. 

0 Kudos
Message 4 of 27
(1,807 Views)

You've use local variables to create a bunch of race conditions.  The behavior is unpredictable.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 27
(1,795 Views)

I have another similar code. It works. I think the issue is caused somewhere else.  This is my upper level code. Do you think it could be the root of the problem?

0 Kudos
Message 6 of 27
(1,794 Views)

Paul

 

This is the way I circumvent the problem. Is there any better solution?

0 Kudos
Message 7 of 27
(1,791 Views)

@Jacobier wrote:

I attached my modified file here. I only changed other places, the place I am confused with remained there. 


All you probably need is a single shift register with a 2D array.

 

Your use of local variables is completely misguided. These local variables on the right will be read once at the start of the program an then ever again. This means you are operating on values that that nothing to do with the final content. They are NOT needed. Did you do  some of the basic tutorials about dataflow?

 

 

0 Kudos
Message 8 of 27
(1,789 Views)

That is what happen to my original code (as shown in the figure 1). The shift register enter the case structure. Then it is refresh to 0. 

0 Kudos
Message 9 of 27
(1,786 Views)

The local valuable does make something wired in other places. I removed them and directly connect to the shift register. But nothing comes out.

0 Kudos
Message 10 of 27
(1,784 Views)