LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronise application with video refresh

Hi all,
 
I have an application in which accurate timing of the display of images on screen is important. Therefore I want so synchronise the display with the vertical video refresh signal of my screen. So I want Labview to wait for the refresh and then display the image.
 
I've stripped my application and attached a small program here:
The application to run is 'Test TIming.vi'.
 
What it does:
For say 500 times, it reads the millisecond timer, displays the image on screen (now randomly moving arrow, the 'DAT_Present Images Timing'-subvi), and afterwards reads the millisecond timer again and it subtracts to the calculate the time difference. These 500 time differences are in the array and min, max, total time are displayed. For 500 runs of 1 screen refresh (100 Hz monitor, thus 10 ms a piece) ... this should be 5 seconds. But on my pc it's ony 3, a lot of 'time differences' are 3-4 ms also. So Labview just runs the display program without waiting for the video refresh... In fact, lots of 'displays' are in between refreshes and therefore are never displayed at all.
 
Is there any way I can make my program synchronise with the refresh such that each display-run will start at the sync?
I hope my question is clear and you guys can help me,
Many thanks,
Michiel Vestjens.
0 Kudos
Message 1 of 13
(4,252 Views)
The millisecond timer function is not a "Real Time" function, it is dependent on the Operating system. If Windows decided to do something it rates as a higher priority then time maybe stolen from other functions, including LabVIEW. If you were able to coax LabVIEW to do refreshes between vertical sweeps it would have to be triggered from some display card signal, and I don't know that these are available to the operating system, much less to LabVIEW. What are you trying to display that is so critical. The human eye will not detect a change that occurs once after two refereshes, then hits the next one ok, etc., unless they are really big changes. If the data is LabVIEW graphical data, the changes won't be visible until you have a fairly large amount of changes present, the eye just won't process it fast enough. To get more accurately executing loops you may want to try the "timed loops", intorduced in the 7.x version of LabVIEW. If you can let us know what and why you need to display with such timing accuracy we might be able to help you better.

P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 13
(4,231 Views)

Thank you for your quick response.

Well, actually I'm trying to measure effects of one frame 🙂 ... so yes, it is important.

You wonder whether the signal from the video card are available to the operating system, and as a matter of fact, it is. I know several programs which make use of it in order to obtain millisecond accurate time under windows XP. The software I'm referring to is often used in experimental psychology. (for instance in reaction time experiments) Two examples are Presentation (www.neuro-bs.com) and E-Prime (http://www.pstnet.com/). These programs read the status of the vertical refresh synch and use it for accurate timing.

My question was whether Labview also has such a VI which reads this signal so I can use it for my experiments.

 

Another option would be to do it by hardware: split the video cable, and inserting the line giving the video signal to the parallel input port which whould then be used as a trigger. But this seems 'the hard way' to go, and I'd rather not.

Message Edited by MVestjens on 09-27-2005 03:12 AM

0 Kudos
Message 3 of 13
(4,218 Views)

Hi  MVestjens ,

Youn asked very important question which ufortunately left not answered in this forum.

Did u find any answer to your question?

 I have very similar problem. I want to output video stream at accurately controllable update rate.

And I want to sync the frame output with another DAQ sortware and framegrabber.

Please let me know

Eugene  

0 Kudos
Message 4 of 13
(4,149 Views)
No, as a matter of fact I did not.
 
I eventually abandoned Labview and rewrote my application in the abovementioned Presentation program. It works reasonalby well. Still, I'm very interested in a solution to this problem using LabView.
 
I've spoken to some guys at Labview and they told me that even Labview RT is only RT in the data-acquisition part of the program, but not in the user interface. So that also is in fact useless to me, as I need a real-time interface. I'm displaying images in a very strictly predefined time-stamped order.
 
Maybe you can split the vga signal cable and then use it as an input? (like I said above), might  something like that work for you?
 
Good luck! And let me know if you find anything 😉
Michiel.
0 Kudos
Message 5 of 13
(4,135 Views)

Hey,

 I am really sorry to hear that Labview is unable to handle such a simple task as to sync the output

of the video card. I heard that Matlab Toolbox allows this sync. There is toolbox called Psychtoolbox,

that was developed by Psychologist:) You can download it from the Internet. I heard that it is great toolbox that allows you, among other things, the sync with the frames flow from the videocard.

I didn't look closely into it yet, but there site liiks impressive.

Let me know.

Evgeny

 

0 Kudos
Message 6 of 13
(4,129 Views)

You changed your name from Eugene to Evgeny? interesting ...

For other projects I have actually used the Psychtoolbox for Matlab, and that indeed works well in solving for various timing and synching issues. It can be a good alternative, yes. Thanks for sharing, I should've mentioned it earlier too.

Still, I think we agree that LabView should also have the ability to synch with the video refresh rate.

0 Kudos
Message 7 of 13
(4,125 Views)

Hey Michiel ,

If you used already this Matlab "Psyh" toolbox, may be u will know

if I can address with this toolbox the following task:

I want to output video image (1024x768 Pixels) via the computer's
monitor connector interface (VGA) to drive videoprojector in my
experimental setup. For that purpose I plan to purchase separate
video card on PCI bus. Two thing are of main importance for my
application:
1) Accurately control the update (refresh) rate. Actually I plan to
output only 2 alternate pictures with accurately controlled update
rate.
2) To be able to sync the output frames with the NI DAQ
 board (data acquisition board) and with another frame grabber in the computer

(May be IMAQ).

The problem is that the DAQ and IMAQ are NI cards (so it is natural to run them with LAbview).

On the other hand Labview is unable to handle the problem as we know.

Let me know

Eugene (This time not Evgeny:))

 

 

0 Kudos
Message 8 of 13
(4,112 Views)
Hi Eugene,
 
I don't think you need to buy a different PCI video card. You can just use a video splitter so you have the same output on 2 monitors.
 
But let's not go into that here on this board. We should end here concluding LabView needs to have a look into this issue.
 
You can email me at M.Vestjens @ psychology.unimaas.nl (whitespace included to prevent automated spam..)
Cheers,
Michiel.
Message 9 of 13
(4,097 Views)
If LabVIEW doesn't have access to the video refresh, then how does the "Smooth Updates" property work? I was under the impression that it checks the operating system for when the video refresh occurs. If it can check it, can't it report it to the programmer?
0 Kudos
Message 10 of 13
(3,823 Views)