LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace Array Subset

Hi All,

I am having a problem with replace array subset. The values are not being retained as I expect but rather the last value in the line. What mistake could I have made that warrants this behavour? Any suggestions will be highly appreciated. Attached please find my codes for both host and fpga.

Download All
0 Kudos
Message 1 of 4
(3,101 Views)

Ho Opuk,

 

please explain where exactly you have this problem! You have attached 3 VIs, but gave no further explanations…

 

I suspect you are talking about the HOST.vi: here you use a lot of local variables (like "Trace"/"Retrace").

- Are you sure you have initialized them correctly?

- You cannot replace non-existing elements in an array: are the index inputs for ReplaceArraySubset valid?

- The event structure is NOT placed in a loop: it will execute just once. Even more distracting: it will block your VI on the second UI event for "Pixel X" or "Pixel Y"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(3,089 Views)

Hi GerdW,

Let me try to explain how my code works. The fpga code is meant to generate a triangular scan wave pattern (Trace and retrace). The data collected at every  X pixel is transferred to the host via DMA FIFO.

On the HOST end, I initialize my 2D array depending on the pixel number which works correctly. I intend to replace the array by the new incoming data from the fpga line by line. When you press the Start Scan button the data is transferred but only the last value in the line is retained as can be seen on the host front panel array indicator called trace.

 

I have placed the even structure in a loop now. Thanks for that.  The index inputs are valid. The initialization works OK.

Any fuurther suggestion or ideas will be highly appreciated.

 

Kind regards,

Opuk.  

0 Kudos
Message 3 of 4
(3,073 Views)

Hi Opuk,

 

I have placed the even structure in a loop now.

The event structure checks for value changes of PixelX and PixelY - but those two FP elements are indicators and will never fire such events!

 

When you press the Start Scan button the data is transferred but only the last value in the line is retained as can be seen on the host front panel array indicator called trace.

"Trace" is empty, nothing can be seen…

As I don't have your hardware (and all the missing LV project data) I cannot run your VI or "press the Scan button".

Furthermore: "DMA Data" is showing 4 columns, but your code creates this array from just 3 1D array (rows). How can this indicator show 4 columns after TransposeArray, when the wire before contains a 2D array with just 3 rows?

- Please clean up your VI! Read the LabVIEW styleguide…

- Provide real data in the FP elements.- When you think you don't understand how ReplaceArraySubset works you can check the example VIs coming with LabVIEW or create a small test VI for learning it…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(3,066 Views)