PDA

View Full Version : light pens



vic user
January 7th, 2004, 06:56 AM
I am about to receive a light pen for the Commodore line of 8 bit machines, and I was reading up on how the light pen determines what part of the screen you are touching.

Here is a quote from the following page:
http://www.atariarchives.org/ecp/chapter_6.php


To understand how a light pen works, you must know a bit about how your computer's monitor displays a picture. Pictures on the screen are made up of tiny dots of light. These dots are produced from an electron gun in the monitor which shoots electrons at the screen. These electrons excite the phosphor coating on the screen, causing it to emit light. In this way, the electron gun actually "paints" the picture, dot by dot, row by row, until the screen is filled. All of this is done in a fraction of a second and is updated many times every second.
Your computer keeps track of where the beam of electrons from the electron gun is at all times. The light pen, when pointed to a spot on the screen, triggers the computer to store the location of the beam as it passes. These x and y coordinates are placed in special registers of your computer. Since the position of the beam stored is the same as that of the light pen, programs can determine where you're pointing the light pen by checking the values contained in these registers. The program can then use this information to perform various functions, like drawing a line or selecting an option.


Now if this is the case, I am assuming that you can use a light pen on a monitor or TV that is actually not connected at all to a computer, yet still send X and Y co-ordinates to the computer.

Reason I want to know if this is true or not, is because I would like to have a small TV or something near the light pen, yet have another monitor or TV as my actual screen for viewing. That way I can have the viewing screen far away from the computer, and don't have to lean over every 5 seconds to use the light pen.

Does this make sense?

Chris

hwhall
January 7th, 2004, 07:45 AM
What you describe would work if you have both screens synchronized, that is, being driven by the same horizontal & vertical synch pulses. That way the position of the electron beam on each screen is the same at all times. Probably simplest way would be to connect both screens to the same video output.
--wayne

vic user
January 7th, 2004, 07:57 AM
Thanks for replying.

I was wondering about that issue, but I thought that since the scan rate is so fast anyway, it would not matter that the screens were synchronized or not.

But if you are correct, it is an easy thing to do, since a splitter doesn't cost much.

Now if I can find a super cheap small flat screen :)

Chris

Terry Yager
January 7th, 2004, 08:24 AM
Thanks for replying.

I was wondering about that issue, but I thought that since the scan rate is so fast anyway, it would not matter that the screens were synchronized or not.

But if you are correct, it is an easy thing to do, since a splitter doesn't cost much.

Now if I can find a super cheap small flat screen :)

Chris

Does a lightpen even work with an LCD screen? They might not give off enough light to trigger the lightpen. Do they even give off *any* light? I thought they only *reflect* light from an external source. (Like the small flourecent light inside a laptop screen, the "backlight").

--T

vic user
January 7th, 2004, 08:35 AM
I was just looking at that light pen link, to see if it answered any of your questions.

The link mentions that you may need to adjust the brightness of the dsiplay in order for the light pen to work properly.

It also mentions that the tip is a phototransistor.

Chris

Terry Yager
January 7th, 2004, 08:50 AM
Oh, OK...kewl...

--T

hwhall
January 8th, 2004, 12:48 PM
>>Does a lightpen even work with an LCD screen? They might not give off enough light to trigger the lightpen. <<

The problem with LCDs is not basically the amount of light, but because they work differently than a raster scanning beam picture tube. The traditional light pens I'm familiar with detect the instant when the scanning electron beam lights the picture tube pixels beneath its phototransistor. The position of the beam at that instant is calculated from the time differences between that instant and the times of the last vertical & horizontal synch pulses (gives the vertical and horizontal displacement of the electron beam on the screen).

I think that all LCDs use transisitors to turn their pixels off and on, and once a pixel is on it stays on until it is turned off (no scanning beam lights each pixel at the instant the beam touches it). That would mean the traditional synch-based position calculations won't work.

It might be worth investigating whether some alternative to traditional lightpens are being offered for LCDs.

-Wayne