LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing values to an array at desired index through RS232.

                    I am logging data to be plotted on a graph.the data to be recieved by PC is from a SPARTAN-II FPGA.

the FPGA sends X and Y coordinates through RS232,in the following fashion

X<data bits>Y<data bits>X<data bits>Y<data bits>.............and so on.

              My serial port read.vi is enclosed in a while loop,with termination control by a quit button on front panel.

i want the values be stored in an array(for plotting as a graph further),but i am unable to control the index number where i want to write the data.(the build array function is inside the same while loop,and overwrites at the first location only)(same was the case with insert to array function).

            Next i tried placing a shift register at the while loop edge,the array i obtain is perfect,but all the array data is available only after the loop is terminated.however i want the values to be plotted 'as they come'(and not after i stop the while loop i.e my "acquisition process").same was the result with auto indexing turned on.

 

          so,boiling down to my question, is there any way to 'take out' data while the loop is running?

OR is there a way i can control at what index i am writing my data in an array.

 

kindly help.

 

Regards,

 

 

0 Kudos
Message 1 of 4
(2,827 Views)

I'm not quite sure I understand why you couldn't get the Build Array to work. That will do what you want without having to worry about keeping track of the index. The biggest downside is that the memory requirements will grow and grow as you build the array. I'm assuming you used a shift register or a feedback node to "hold" the array in memory? How much data are we talking about here? If you can make it into a fixed array then you can pre-allocate the array and just use Replace Array Subset. This will require you to keep track of the index, but that's not hard to do.

 

As for the plotting, you can just use a chart inside the loop. It has a built-in buffer.

 

What have you tried so far?

0 Kudos
Message 2 of 4
(2,822 Views)

heartliest thanks for the concern!

 

I'll be needing at least 16 K locations.

i havent tried the plotting.i guess once an array is formed,plotting would be easy,right?

i am attaching my VI here.

     as i mentioned the build array function is writing data only at first index(at the'build arrray o/p' indicator).next i am getting an array i desire(at the 'array' indicator)but only after i hit the 'QUIT' button(i.e after i stop the while loop).

  it'd be nice if the while loop gives an output after each iteration as it does in C,rather that spitting out all the values at once.

 

Regards,

 

 

 

 

0 Kudos
Message 3 of 4
(2,811 Views)

If you put your Build Array O/P or Array terminal inside the loop right after the Build array function where you are concatenating the new element to the existing array from the shift register, then put it back into the shift register, you'll get what you are asking for.

 

It seems like you are almost doing what you want, but don't seem to understand enough to take that last little step.  I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 4 of 4
(2,809 Views)