LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with my project

Solved!
Go to solution
Solution
Accepted by topic author zqz51911

@zqz51911 wrote:

Hi Knight of NI, I still have some problems, sorry to bother you again.

The problem is why my vi can only output in array 2(in the loop) while the vi running. If I want to output in array 1(out of the loop), I need to click the stop button every time.

 

Another problem is the reset button, I want a reset all the value to zero when I press this button, however it did not work.

 

The last problem is when I run the vi, when the first time I press the “toggle” ,in the “Frequency” and “break” indicator, there always some random number come out unless I press three times to finish a cycle the number will remain normal.

 

Thanks

fourm problem.png


r-click the event structure and Add event, then add a Reset button:Value change and move the reset-code into that one. The event structure is basically a interrupt-driven case structure. That's also how you avoid having multiple event structure, just add events to the same one. (In the rare case where you actually need multiple event structures they should be in separate while loops)

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 21 of 34
(2,118 Views)

zqz51911 wrote:

fourm problem.png


While you are at it, learn about dataflow. From the placement of the local variables on the bottom right, it seems you are epexting them to go to zero when the program completes. However, since there is no data dependency, they will execute in parallel to your main loop when the program starts and you could create race conditions.

Message 22 of 34
(2,114 Views)

thanks, I am really new to labview 

0 Kudos
Message 23 of 34
(2,102 Views)

another question, I want to convert my output from  vertical 1d array to  2d array spreedsheet table, how to achieve that fuction?

1212.png

0 Kudos
Message 24 of 34
(2,070 Views)

Are the strings always the same and in the same order? (If not, the problem will be much more complicated.) 

 

If so, you can extract the strings once and build the header row as a 1D array of strings

 

Then autoindex on the array of cluster, unbundle the numbers, build them into an array and format them into an array of strings. Autoindexing on the output tunnel will give you the 2D array, one row per array element.

 

Add the header row to the top.

 

 

 

0 Kudos
Message 25 of 34
(2,054 Views)

the order is the same , I try to use unbundle cluster to achive this funchtion , however the output 2d array give me vertical result ,i need the flat one

0 Kudos
Message 26 of 34
(2,047 Views)

Reshape both columns.

0 Kudos
Message 27 of 34
(2,041 Views)

at the beginning of my vi running, there always some big random number come out, where is the problem come from ?problem1.PNG

0 Kudos
Message 28 of 34
(2,002 Views)
Solution
Accepted by topic author zqz51911

You don't initialize the shift registers,  so they will contain whatever data was in there the last time you ran the VI in the same edit session. The data is not random, but will tell you exactly how long you waited before running it again. The first time you run it, it will contain the default time, which is January 1, 1904, giving you a very, very big difference.

 

You need to initialzie the shift registers!

 

  • For the time ones, just get the time once before the loop and wire to the outside of the two shift registers. (If you don't the first time difference will include the time between runs)
  • For the array you are building, just right-click the shift register on the left and "create constant" to initialize it with an empty array of the same type. (If you don't , the array will grow without bounds and will include data from previous runs).
0 Kudos
Message 29 of 34
(1,996 Views)

thanks a lot

it works

0 Kudos
Message 30 of 34
(1,992 Views)