I'm starting with a simple crosshair video interaction circuit to show the X Y position of a sensor on the monitor. The circuit works using an LM339 comparator to compare the horizontal and vertical ramping voltages to the X,Y voltages. The comparator output transistion from low to high when the ramping voltages become grater than the X,Y voltages. This triggers an edge detector circuit to output high for a set amount of time. The edge detector on the vertical section outputs higher much longer because it needs to stay active for several scanlines to draw a horizontal bar. The outputs of the two edge detectors are combined with an OR gate that goes to the RGB inputs. If I'd used an AND gate I'd be producing a small rectangle where the two lines intersect.
This is the output of the circuit on the monitor. As you can see the horizontal position is off. This is because of the signal delay between the detector and sample-and-hold circuit. Adding separate ramp triggers only stops this from producing wrap-arounds at the edges of the screen, it doesn't remove the effect entirely. I had this issue with the zapper project and solved it by using a 555 to produce many vertical lines so there was no obvious center to be out of position.
This time I'm solving it in a better way. I'm adding a monostable circuit to the horizontal axis. The monostable delay is tuned to equal the time required to draw a scanline minus the sensor signal delay. This way an output pulse is produced in the correct horizontal position on the next scanline down.
Crosshairs aligning to phototransistor.
After rethinking some things I've realized I can eliminate the signal delay problem completely by moving the monostable delay circuit into the light gun curcuit. This way the horizontal sample-and-hold circuit will store a value matching the ramp exactly when the raster beam was detected; but produced from the ramp signal one scanline after the detection.