Light gun input?
Posted: Fri Aug 29, 2008 9:31 am
Yeah, more random suggestions.
If you have a spare counter that can be clocked at something close to the pixel clock (even a half or a quarter the pixel clock rate) we could connect a light gun (or two) to the hardwired external IRQ inputs. (INT0/1)
Start the counter at the beginning of each scan line. If an interrupt is detected (falling edge), the gun is pointing at the (CRT) screen and sensed a 'hit'. Stop the counter-- that's your 'X' position, the line count at the time is your 'Y' position. You then need to apply a calibration procedure (aim at the center of the screen, etc) to compensate for the (relatively) slow turn-on time for the photodiode in the gun and effects of the lense and stuff. It works though...
After the first interrupt I just mask off the interrupt until the start of VSYNC for the next frame (otherwise you can get multiple interrupts because of the focal distance of the gun). Not sure if that'd mess up your on the fly pixel shifting too much though! (might tear the line? could be OK in some applications depending on the background I suppose) I really need to read the kernal and see how you're generating sync.
-Clay
If you have a spare counter that can be clocked at something close to the pixel clock (even a half or a quarter the pixel clock rate) we could connect a light gun (or two) to the hardwired external IRQ inputs. (INT0/1)
Start the counter at the beginning of each scan line. If an interrupt is detected (falling edge), the gun is pointing at the (CRT) screen and sensed a 'hit'. Stop the counter-- that's your 'X' position, the line count at the time is your 'Y' position. You then need to apply a calibration procedure (aim at the center of the screen, etc) to compensate for the (relatively) slow turn-on time for the photodiode in the gun and effects of the lense and stuff. It works though...
After the first interrupt I just mask off the interrupt until the start of VSYNC for the next frame (otherwise you can get multiple interrupts because of the focal distance of the gun). Not sure if that'd mess up your on the fly pixel shifting too much though! (might tear the line? could be OK in some applications depending on the background I suppose) I really need to read the kernal and see how you're generating sync.
-Clay