LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquisition on NI sbRIO 9636

 

 

Hello! I am working on my faculty project and I have to do acquisition on NI sbRIO-9636. How can I choose sampling period of acquisition? I am working according to an example on NI website below:

 

http://www.ni.com/tutorial/4534/en/

I can't figure it out which sampling period should I put in Host.vi and which in Target.vi in order to have proper acquisition? For an example, I would like to have sampling period 10 milliseconds. How to configure loop-time in Host.vi and how in Target.vi?

 

Thank you

0 Kudos
Message 1 of 6
(3,552 Views)

Hey there,

 

You can use the timing functions in LabVIEW FPGA to time your sampling period. See "Measuring Loop Timing in LabVIEW FPGA" on this article:

https://learn.ni.com/learn/article/getting-started-with-fpga#toc5

 

The Tick Count function can also be configured to measure ms, so you can configure your sampling to run until a certain number of ms has elapsed.

Daniel C.
Applications Engineer
National Instruments
Message 2 of 6
(3,384 Views)

Hello Daniel,

 

Thank You for Your reply.

 

I've tried to do something, but it wasn't ok.

 

Here is my Target VI. I've put here 1000 Ticks in Count control.

 

odzivFPGA_ok1.PNG

Here is my Host VI.

 

host_ok1.PNG

 

 

Like I am using only one element out of 100. And like other data 'arrives' late on the graph. I've put here 10 ms loop period.

 

Could You please explain me what happened and how to fix this? I really don't understand...

 

Thank You

0 Kudos
Message 3 of 6
(3,358 Views)

I don't understand what you are trying to do here

 

First, on your FPGA VI, you do not need to build array, and then run the data into a for loop. This is redundant

 

Second, what do you mean that you are only using one element out of 100? I see that you are reading 100 elements out of your FIFO. When you do that, the function must wait until there are 100 elements to read in the FIFO before it will actually read (or it will timeout). If you only have one element in the FIFO, it will never read.

 

What do you mean data arrives late?

Daniel C.
Applications Engineer
National Instruments
Message 4 of 6
(3,336 Views)

A FIFO is a First In First Out data transfer mechanism. When you put an item into a FIFO it gets added to a buffer and then on the host side you can read the items out of the buffer.

 

If you put an item into the FIFO every 10ms (using timing on the FPGA VI like you have done - make sure to check the time is right - is it currently 1000ms, us or ticks? ticks run at the rate of the FPGA - i.e. 40Mhz but you can configure it to be ms) you can either:

- Read 1 item out of the FIFO at a time in your host VI, and the loop will run at about 10ms returning 1 point at a time. You probably don't need execution timing (the 10ms wait) unless there's an error (to stop the loop consuming all CPU).

- See how many items are in the FIFO in the loop and read that many items to 'flush' the buffer and then you will need to decide what to do with the extra items. You can do this as slow or as quickly as you want (with execution timing) - as long as your buffer doesn't fill up.

 

Also, in your VI, you are reading multiple items and only taking one item. The item you are pulling out of the array is the first item which is actually the 'oldest'. Doing a reverse array before indexing the item out of the array will return the most recent item.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 5 of 6
(3,307 Views)

 

Daniel and Sam,

 

Thank You for Your replies.

 

 

I will remove this function for building an array. 

 

I will now explain what confused me. 

 

 

The sampling period should be 1000/ 40 000 000 s, that is 25 microseconds. I have Host loop rate 10 ms. That means I read 100 elements every 10 ms? 

 

 

Okay, now when I calculate I have 400 elements in FIFO buffer during 10 ms of acquisition. But, I only read 100 elements and FIFO buffer is filling in.  

 

Now, I am using only 1 sample out of 100 an send that one on graph. What happens to the 99 unused samples? Are they just thrown away and in the next host loop iteration I read another 100 of samples, again use only one and the rest throw away and so on? 

 

 

 

About 'samples that arrive late': 

 

I will try to make it simple (I am still talking about my VIs in this question)

 

Let's say that we have 2 packages: First package contains first 400 samples, second package contains 400 samples that were acquired after first 400 samples. First package is 'older' than the second one.

 

When I read 100 samples I actually read 100 samples from the first package. The second host loop iteration reads 100 samples from second package or from the first package? I think from the first, because I read samples I have acquired 'long' time ago, an not the latest ones.

 

Can I put in the number of elements 400, and keep all the rest to have real-time acquisition and proper data shown on the graph? I suppose I should save data to some Excel file to keep all data I acquire. 

Could You please answer me? 

 

Thank You

 

0 Kudos
Message 6 of 6
(3,285 Views)