Download
LPTScope
Download
source

LPTscope is a MFC program written in VC++6.0.
The program
reads directly from I/O adress 888 which is LPT1 data port on most PCs. If you
use Win95/98/ME everything is ok about direct reading from the LPT1. But with
WinNT/2k/XP (NT based) things are a little complicated. I/O ports are protected
from direct access. You can read this
article for detailed info.
To work under NT based OS, LPTScope uses PortTalk driver for
direct access to LPT1 port under WinNT based OSes. Craig Peacock did a nice job
with that.
But, the driver intermediator reduces the speed performance of
the oscilloscope a lot. For best performance use Win95/98/ME. Somebody could
make a change in the code of PortTalk driver to do a block reading, not just
byte by byte reading. I don't have time enough for that. The init part of the
program (CMainFrame::OnShowWindow) detects Win version and if this is NT based
Windows then PortTalk is automatically installed and started. If you want to
uninstall the PortTalk driver just delete the file
\WinNT\system32\drivers\porttalk.sys and registry key:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PortTalk].
To
uninstall the LPTscope program, just delete the LPTscope.exe file.
The init
part of the LPTscope also measures the PC speed. This is achieved by a simple
times-of-loops counting in a given period. This information gives us the max
sample rate possible on the given machine.
LPTscope reads the samples at the
maximum speed all the time. By changing the time base we don't make any
difference on the reading speed of the samples. The efect of changing the time
base is implemented at display-time only: not all the samples are shown in the
case of lower time base than the max one.

The principle of the how the
program works is quite simple: A separate thread (ReadThread()) reads a block
of MAX_SAMPLES samples from LPT1 and after that it sends a notification to the
view to display this freshly readen block of data. The user can change time and
Y base on the view side, click and move to measure precisely the signal with
the mouse, change trigger properties etc.

The program is tested on
Win98,Me,2K and XP.
I hope you will find it useful.
Drop me a note if
you find a bug or after making some meaningful change to the code. Read the
agreement if you intend to have any other use than a personal
one.

TODO:
· Detection of the
available LPT ports.
· Optimize the PortTalk driver for our specific use.
This could be useful and faster when running on
WinNT.

How
to talk with a LPT (and any other) port from within NT based Windows:
PortTalk driver - my
favorite
http://egor.spb.ru/doc/BookCD/DrDobbs/articles/1996/9605/9605a/9605a.htm
http://64.113.35.210/tviclpt.htm - a
serious commercial solution