10-30-2020 07:33 PM
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?
10-30-2020 08:13 PM
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
10-30-2020 09:15 PM
You shouldn't expect them to be the same. "appended array" is inside a case structure, "y 3 2" is outside.
10-30-2020 09:20 PM
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.
10-30-2020 09:28 PM
You've use local variables to create a bunch of race conditions. The behavior is unpredictable.
10-30-2020 09:28 PM
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?
10-30-2020 09:30 PM
Paul
This is the way I circumvent the problem. Is there any better solution?
10-30-2020 09:32 PM
@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?
10-30-2020 09:59 PM
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.
10-30-2020 10:09 PM
The local valuable does make something wired in other places. I removed them and directly connect to the shift register. But nothing comes out.