02-12-2009 12:35 AM
Hi,
In my application i have RT host vi and FPGA VI. i am using DMA FIFO transfer data and display in RT HOST VI. Also I am using FPGA read/write nodes in RT host vi to write to controls in FPGA VI to output data using digital I/O modules. When i run the rt host vi it looses connection. only way to rerun the program is to physicaly hit reset button in rt target. Is there a way to fix this?I using LABVIEW 8.6. Thanks.
02-12-2009 12:42 AM
02-12-2009 10:37 AM
Hi
Thanks for the reply.
RT front panel that is in windows pc looses connection. I have only one loop in RT vi now. I reduced the loop rate of my SCTL in my RT vi then it started to work. But I need faster loop rate because I want to be able to write to digital I/O module and have data avilable deterministicaly. Before I had 2 RT loops referencing to 1 FPGA VI. One for writing data to boolean control in fpga vi and other one for read data from DMA FIFO and calculate and display PSD and RMS values. I am sampling 25ks/s in FPGA VI. and reading at 1000 samples at time in RT vi.This method didn't work really well (very slow). Could you tell me best way to do this? Thanks.
02-12-2009 10:53 AM
02-12-2009 11:03 AM
suni wrote:Hi
Thanks for the reply.
RT front panel that is in windows pc looses connection. I have only one loop in RT vi now. I reduced the loop rate of my SCTL in my RT vi then it started to work. But I need faster loop rate because I want to be able to write to digital I/O module and have data avilable deterministicaly. Before I had 2 RT loops referencing to 1 FPGA VI. One for writing data to boolean control in fpga vi and other one for read data from DMA FIFO and calculate and display PSD and RMS values. I am sampling 25ks/s in FPGA VI. and reading at 1000 samples at time in RT vi.This method didn't work really well (very slow). Could you tell me best way to do this? Thanks.
Can you clarify wat you mean by "SCTL in my RT"? SCTL is a single-cycle timed loop which exists only on the FPGA, not in the RT code. You do need to slow down your RT code in order to allow the front panel communication thread enough processor time. Can you use larger FIFOs, and process the data in larger chunks? This might allow you to run your RT loop at a slower speed but still maintain the same data acquisition rate. You could also use the same size DMA FIFO but instead of immediately processing that data, put it into a queue or RT FIFO, then let another loop in the RT code handle your analysis at a slower rate by reading from that queue or FIFO. When you say "really slow" how slow is that? Which part needs to be faster? How frequently do you need to calculate PSD and RMS values? If you're just looking at it on the screen there's no need to update any faster than about 5x/second, whereas right now it sounds like you're updating 25x/second.
02-12-2009 02:29 PM
Thanks for the reply.
I wanted to say timed loop in my RT vi. I thought SCTL and timed loop are the same. That was mistake. sorry.
I have two DMA FIFOS for 2 signals set at 8192 elements in FPGA. In RT vi I am processing them (FIFO read function) 1000 elements at a time. I can try to use larger FIFO. How slow should i run my RT loop? Do two DMA FIFO make proccesing time in RT loop slow?
When i had 2 loops one for analysing and update controls it took significant delay to update the graphs when i changed the signals. I want to read PSD and RMS every 20ms. I am not just looking at those graphs, i am using those RMS to update controls in the FPGA VI.
Thanks.
02-12-2009 02:51 PM
02-12-2009 02:54 PM
suni,
I think Adnan Z and nathand hit the nail on the head. You need to put everything that is time-critical (data acquisition and processing) in one timed loop with a higher priority. The loop that controls the user interface needs to have a separate loop that has a lower priority. This will force the controller to execute the high priority loop at the correct speed, then when the processor has time, it will execute the low priority loops. There is a basic framework for this that is shipped with LabVIEW. Select File»New and then browse to Project»Project from Wizard»Real-Time Project. Pick a name and click Next. Then choose the box to include a user interface.
I have included a screenshot of the block diagram of this template.
02-12-2009 07:50 PM
Hi
Here is my RT code and FPGA vi. For your question "What mechanism are you using to limit the RT loop cycle time? " I am not sure how to do this. I am running rt loop at 20ms now and it is functioning faster than before. But I would like to see ways improve my code.Thanks for your help.
02-13-2009 09:17 AM
suni,
Your timed loop will run at the specified dt unless it cannot complete all of its code in the given time. If you are looking at optimizing your FPGA code here is a good DeveloperZone Tutorial.