View Single Post
  #1   Report Post  
Posted to sci.electronics.design,sci.electronics.repair
Dimitrij Klingbeil Dimitrij Klingbeil is offline
external usenet poster
 
Posts: 56
Default PC timing problem

On 23.06.2017 04:15, John Larkin wrote:

Today a couple of guys literally walked up to our place and rang the
doorbell, looking for help. They are medical types who know
basically nothing about electronics.

They want to plop a still image on a PC screen and simultaneously
trigger some external gear. They would like those to be coincident to
within maybe a millisecond. This will be a Windows machine, hardly a
realtime OS. I don't think I could load a screen and simultaneously
bang a serial port pin, or some USB device, accurate to a
millisecond. Well, probably not.

....
Let's say when the image is all on the screen. That suggests that the
optical sensor wins. I guess the video signal sent to the LCD screen,
and the screen refresh, are asynchronous. There is probably a way to
synchronize video ram loads with screen refresh, but I'm not
volunteering to write any device drivers.

....

Hi John

Frankly, I don't think that the various video latencies involved will
give you a 1 ms total timing budget.

Modern LCD monitors are some complex beasts, they generate their own
screen update timing. What you send on the VGA/DVI/HDMI port is no
longer synchronous with the LCD "on the glass" drive signals. Especially
if the input signal is analog (VGA), the monitor will, after digitizing
it, store large chunks and run it through a lot of processing (resize,
anti-alias, filters for various "enhancements" such as edge sharpness)
before buffering the whole frame in order to be able to output it to the
LCD at some potentially unrelated LCD-specific frame rate, which might
not even be publicly documented anywhere.

So you have 2 areas of non-synchronous behavior:
1. in the graphics card (memory write by a driver vs. video output)
2. in the monitor (received video signal vs. LCD panel refresh)

At least Nr. 2 is not under your control, even if you decide to write
drivers, plus as soon as different monitors are used, timing won't be
repeatable any more.

You can use the photodiode trick, but this assumes that the image
arrives at the monitor in whole rather than starting somewhere at a
random line of the screen, progressing to the last line and then
finishing the remaining part from the top. The starting position won't
likely be under your control, as won't be the exact time that the LCD
panel will take to refresh (plus the frame takes longer than 1 ms).

Additionally, the liquid crystals in the LCD itself typically have
longer than 1 ms response times plus the response times are
voltage-dependent (depend on the content of the picture) and asymmetric
(relaxation can be considerably slower than electrostatic alignment), so
going from dark to bright is not the same at going from bright to dark,
and the actual levels (both absolute and relative) of "bright" and of
"dark" also affect timing. The time constants involved are on the order
of single digit ms, but this already eats the 1 ms budget.

Since quantity and series production are both presumably not an issue, a
more likely approach to reach 1 ms timing may be a hardware hack of the
monitor itself. Rather than controlling the content of the video stream
with precision timing (thwarted by monitor buffering and LCD refresh) it
should be much easier to control the LED back light.

LCD TVs, and presumably monitors too, tend to have circuit boards for
power and for video. The power stuff has 2 or 4 layers and cheap PCB
technology as it needs neither BGAs nor controlled impedances, while the
video stuff is more complex and costly per PCB area, so they keep the
area of the video board to the minimum. The drivers for the back light
LEDs tend to be on the power board, not on the video board, and the
connection, again for cost reasons, uses the fewest number of wires
possible. Often, there is only one single wire that controls the LED
state as well as their brightness by using PWM. Hacking a small board
with an AND gate into this circuit as well as some ESD protection for
good measure should be technically possible (as well as a mounting an
SMA jack somewhere).

Whatever generates the timing, could then distribute the same signal to
the new "light enable" port on the monitor and to the other gear.

Dimitrij

P.S. Just recently there was a thread on sci.electronics.repair that
dealt with light-related issues in TVs and hacking them to get the
maximum brightness reduced. Maybe somebody from there can suggest
monitor-related info too.