LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Losing data from frame grabber

Solved!
Go to solution

Hi, I have a frame grabber PCI card in my PC that is receiving streaming data from an autonomous source. The card came with its own driver/library and sends an interrupt after 32KB of data has transferred (can't make that buffer bigger). When I process that data and display it via the PlotIntensity() function, I sometimes miss/lose data most likely due to the time taken to plot. I tried running the data processing in a separate thread - asychronous timer, but it appears that the ProcessSystemEvents() has no effect in a secondary thread, so the PlotIntensity doesn't happen and no display. Is there a way to set this up so that the frame grabber interrupts happen in a secondary thread? Or is there a way to get PlotIntensity to work in the secondary thread?

Thanks, Mike

0 Kudos
Message 1 of 4
(2,832 Views)
Solution
Accepted by topic author mike.g

Hi Mike,

 

Have you considered setting up thread safe queues to store and read the data? You should be able to store all of your data in one thread and read from another thread without missing any data this way. I've provided a link below to help page on them that has more info:

 

Using Thread Safe Queues to Protect Data

Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(2,785 Views)
Solution
Accepted by topic author mike.g

Thanks! I will give it a try. Do you know if there is a size limit to Thread Safe Arrays? Mine will be over 150KB.

0 Kudos
Message 3 of 4
(2,772 Views)
Solution
Accepted by topic author mike.g

I can't find documentation on it but I would assume it would be the largest block of contiguous memory that LabWindows/CVI could allocate, which I would guess would be more than 150kB. Here's a help page that may be applicable to allocating more memory for a specific thread, although it may only apply to the Real Time Module.

 

Creating an Appropriate Memory Buffer

Applications Engineering
National Instruments
0 Kudos
Message 4 of 4
(2,765 Views)