LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save Sequence Images with a given timing

Solved!
Go to solution

Hi Emanuele,

 

I think I understand your question now.

 

The IMAQ circular buffer in which you store your images -- the one where buffers are reused -- has nothing to do with the queue.  They are two separate memory spaces.  Remember the code I posted when we were looking at loop speeds, which didn't have a producer/consumer architecture (and therefore no queue)?  You were still using a circular buffer to acquire your images. 

 

Once your producer loop enqueues an image, that image stays in the queue until it is dequeued by your consumer loop or unless you release the queue.  It is not overwritten when you enqueue another image.  So if your producer loop stops, and there are still, say, 50 images in your consumer loop, those images will not be lost unless you release the queue before you dequeue them. 

 

The latest VI I posted does not release the queue until the consumer loop has dequeued and processed all of the images.  Therefore you won't lose any of your data.

 

If you want to know how many IMAQ buffers you have to configure in order to not overwrite data, as we discussed in a previous post, you can calculate that yourself.  Since your producer loop takes ~62msec to run, and you are acquiring an image every 50msec, you can do the math to figure out how many buffers you need to configure.  You don't need to worry about your consumer loop speed since I've ensured that the consumer loop won't stop until all of the images in the queue are processed.

 

I'm a little bit disappointed in you, that you waited for me to post a solution for the consumer loop, and then jumped straight to using what I posted, before trying to code one yourself.  I think it's definitely time for me to stop writing code for you.

 

Did I answer your question, though?

 

Diane

0 Kudos
Message 61 of 69
(1,301 Views)

Dear Diane,

 

I think now I understood better how the program works, but tomorrow I'll study the thing in detail as I want to understand it better.

 

I didn't know (or at least I didn't understand) that you posted the program with the consumer loop solution, I thought it was an incomplete VI with some messages which could suggest how to build it, and which in any case I had to complete, that's why I opened it. I realized later that it was the program with implemented one of the solutions you suggested. I do apologize, but as I told you English is not my first language and sometimes I might misunderstand something ... especially if I read your messages at night (like now), when I'm quite tired.

 

I'll try to watch the course slides as soon as I can, as I'm interested in understanding better how to build a code and the fully functionalities of Labview. I think this weekend I'll have some time.

Does the three-hour course also contain info on the shift-register (which is one important thing I didn't understand) or do I have to follow the six-hour course for that?

 

I would like to thank you again, probably I'm saying it too much, but I haven't found anyone as good as you that could help at the University where I'm working, and I really owe a lot to you, also for giving me some motivation when I thought I was lost.

 

Have a good day.

 

Emanuele

0 Kudos
Message 62 of 69
(1,299 Views)

Hi Emanuele,

 

The three-hour course will cover most of the basics, which includes shift registers.  In the meantime, there's always that terrific resource, the LabVIEW help files:

 

shift register LV help.png

 

That's always a good place to start.  You can learn about all kinds of things there, as I have mentioned previously.  Smiley Happy

 

I do appreciate your kind words, excellent manners, and professionalism.  I wish all of the forum users were as polite and friendly as you are.  It can be very intimidating to learn and try new things, especially if you have a deadline, and you have stuck with it even when I know you felt frustrated and lost.  Nicely done!

0 Kudos
Message 63 of 69
(1,293 Views)

Dear Diane,

 

thank you for your words too.

 

Today I've tried to run the programs again, but still sometimes I was not able to get the required number of images. The first time I noticed that my antivirus was running, after I turned it off the situation improved but it seems that there is something wrong in my computer. For the moment this is the only computer I was given compatible with my PCIe card, I don't understand why I have this behaviour...the computer is quite old and it was used by many persons in the lab before me, in this period I don't have time to format it and re-install Windows and everything...

Anyway, it is not possible that the program sometimes get the right number of images and when the CPU is busy it doesn't...

 

Sometimes I feel discouraged when I have these problems...

I hope to sort them out soon.

 

Emanuele

 

0 Kudos
Message 64 of 69
(1,281 Views)
Solution
Accepted by Emanuele_S

Hi Emanuele,

 

I'm sorry to hear that.  I know that such things can be very frustrating.  I've made a very small modification to the VI, but I don't know if it will help.  It might very well just be your computer and if it is, there's not a lot you can do about it.  When you're having the problem, what are your loop speeds?  How many images do you acquire?  How many do you expect?

 

Like I said, this may not help your problem at all, but it's all I have to offer at this point.  Building systems can be frustrating, can't it?  I've been doing this kind of thing -- integrating software and hardware -- for a long time now and it seems like everything just has to put up a fight!

 

Hang in there.

 

Good luck.

Diane

Message 65 of 69
(1,279 Views)

Thank you Diane, the computer is slow and old and when it starts up sometimes it also automatically starts downloading updates for the software, such as windows, but also Mozilla Firefox... I think it was downloading that and it slowed down the CPU: as a results the loop time of course was increased.

For example when acquiring as 20Hz, the extraction loop time was more than 50ms, and so there was a delay...

 

when I do my experimental tests I'll turn off the antivirus and internet to reduce these inconveniences. And I will also ask for a new computer for the future.

I'll plan to follow the Labview course tomorrow morning, so that I can be much more autonomous in correcting errors or improving codes.

 

Have a good day and a good weekend.

 

Emanuele

 

0 Kudos
Message 66 of 69
(1,276 Views)

Hi Emanuele,

 

Yes, if you were seeing a slow extraction loop time (you don't say how slow), you could find yourself overwriting buffers as we've discussed previously.  I think your idea of eliminating other processes (and asking for a new computer!) is a good one.

 

I'm glad to hear that you're going to go through the online course soon.  I think you will find it very useful!

 

Enjoy your weekend!

Diane

0 Kudos
Message 67 of 69
(1,274 Views)

Dear Diane,

 

I don't have questions for you, I just would like to tell you that I started a short Labview course held directly by National Instruments UK at the University of Manchester, where I'm working. This will provide me with a more sistematic background knowledge of Labview, and hopefully I won't ask anymore too basic questions in the future.

 

Thank you for your help. Is it possible to contact you directly in the future if I have other questions to ask?

 

Have a good day in the US.

Regards,

 

 

Emanuele

0 Kudos
Message 68 of 69
(1,237 Views)

Diane,

 

Have you ever done this in reverse, display an image stack or sequence if you prefer, using a producer consumer loop so you can play back realtime or move to a given frame within the stack?

 

 

Bill

0 Kudos
Message 69 of 69
(1,208 Views)