LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Intensity Graph Problem

Hi All,

I have been fixing an intensitiy graph on my code for awhile now but I still have a couple of issues to solve,

I need to plot line by line on the intensity graph, but then all I see is the image on the whole graph as soon as i press start button.

I do a raster scan and for a given number of Xpixel I increase the Y pixel by 1.

Now these are my problems;

1. I have 3 columns in the array.....Z signal, Xpixel and Y pixel. sometimes the columns interchange. i dont know why.

2. I need a line by line plot. what am I not doing right?

3. I think I have a problem with the DMA FIFO. what could b the problem with my set up (see the attachment)?

4. When I press the stop button. there seem to be some data transfer even after the stop button is pressed, why?

5. The trace and retrace indicators on the host someties are ON at the same time meaning there is a problem with my data transfer (Only 1 of them should be ON at a given time)?

 

I have attached some part of my code. Its a little complex at the

 

 

Any ideas or clues on any of these will be highly appreciated.

 

Kind Regards,

Opuk

Download All
0 Kudos
Message 1 of 9
(4,516 Views)

Hi,

 

it's kind of hard to debug without all the code.

What's visible in the second screen cap is a possible race condition with the boolean "Trace" which is written outside the case structure and read inside without a way to force an order of execution. Local variable are dangerous. In LabVIEW the wire is the variable you should use.

Am I correct in assuming that you are new to LabVIEW (the infinite loop is another tell)?

If so I would recommend taking the tutorials NI provides.

 

Best Regards,

Florian

0 Kudos
Message 2 of 9
(4,473 Views)

Can you attach a VI with some standard data? At the DMA Fifo.read you can make an indicator on the "Data" output. Run the VI once to populate the indicator, then right click on it (on the block diagram) and choose "change to constant". This will give us an idea of the kind of data you are seeing. Then send the VI with all of the logic and array manipulation after that.

0 Kudos
Message 3 of 9
(4,457 Views)

Hi Florian,

You are absolutely correct, I am new to labview. Just learning now and I have been going through lots of tutorials.

I developed a state machine that performs a raster scanning. This works pretty well without any problem.

My problem is on data transfer from FPGA to host using DMA FIFO most of which are highlighted in the previous post.

 

 

Kind Regards

Opuk

 

 

 

Download All
0 Kudos
Message 4 of 9
(4,417 Views)

Opuk wrote:

You are absolutely correct, I am new to labview. Just learning now and I have been going through lots of tutorials.

 


 

Showing trucated diagram and front panel pictures is completely useless. You need to attach the actual VI else we cannot help. We cannot see what's in the other cases and some of your wires are hidden. There is blatant overuse of local variables and the actual terminals are nowhere to be seen.

 

Just a few general comments. (I don't have access to FPGA at the moment, so I cannot test):

 

  • The "toop retrace" 2D array belongs in a shift register or even a DVR. No need to pump it in and out of a front panel object via local variables. You don't even necessarily need an indicator.
  • Why is the 2D data DBL? Wouldn't I16 be sufficient?
  • Why are you converting the transposed I16 array to DBL, just to display it in a SGL indicator a nanosecond later? You are createing way too many unecessary data copies in memory. Pick a representation and stick with it.
  • Why do you need to read "Pixel X" from a local variable twice in a row and multiply it with 3 twice in a row within nanoseconds? Do you expect different results? Once is enough, you can branch the wire. Even better, read from the actual terminal! 
  • Why is "pixel X" orange? It should be blue.
  • You definitely have race conditions, because there is no guarantee that the "Trace" local variable gets written before trace local variable higher up gets read. That misplaced shift register won't help.  eliminiate the locals and only use the shift register.
  • Your VI apparently cannot be stopped, just aborted. Why?
0 Kudos
Message 5 of 9
(4,394 Views)

Hii All,

Thank you so much Altenbach, Florian.Ludwig Florian.Ludwig and GregoryJ for your responses. I have tried to implement most of the suggestions you suggested.

As requested, I have attached the host and fpga vi to give more information.

 

Thank you.

 

Kind Regards

Opuk

Download All
0 Kudos
Message 6 of 9
(4,349 Views)

10 second glance at host code:

 

  • The small loop in the lower right spins millions of times per second, starving all other processes for CPU. (See also). the intensity graph only needs to be updated whenever the array data changes. Just place the intensity graph terminal in the loop on the left and pick what needs to be graphed.
  • What determines the loop rate of the upper loop (the one inside the case structure). Deons't it constanty overwrite the two arrays you are trying to modify in the lower loop?
  • In the upper loop, you are building the 1D array into a 2D array with exactly one row. How are you supposed to replace data in other rows if these rows don't even exist?
  • The case structure to the right of "replace array subset" has two identical cases. Why is it even there if the selector makes no difference?
  • The top loop contains a while loop inside a case structure. Shouldnt it be the other way around? (currently, you only have one case, so it does not matter yet).
  • none of the code makes much sense to me. Sorry.
0 Kudos
Message 7 of 9
(4,335 Views)

Hi Altenbach,

Thanks a bunch. Your suggestions to this problem was an eye opener. I implemented them and with a couple of some other trials managed to sort out the problem. Thanks guys for your ever willing heart to offer solutions in the forum.

 

Kind Regards,

Opuk

0 Kudos
Message 8 of 9
(4,242 Views)

Hello Opuk, 

I came across this post while having the same problem and I am also working on the same kind of AFM imaging. I am gald that I found this post but it seems quite old. 

If you receive this message could you please let me know what else you have changed in your code? Please

I will be grateful to you for your kindness. 

 

Thanks

 

Imtisal

0 Kudos
Message 9 of 9
(2,516 Views)