Re: Parallel port and Visual Basic?



On Sat, 09 Apr 2005 15:36:12 GMT, "Zucker" <zuckuss@xxxxxxxxxxx>
wrote:

>I am in the process of building a circuit that will monitor the start and
>finish times for pine box derby cars. I would like to be able to catch these
>events by feeding signals, through the parallel port, to a Visual Basic
>program. I was thinking of using the eight data pins from the parallel port
>to monitor eight lanes.
>
>The electronics are good to go. My problem is with Visual Basic.
>
>Does anyone know how to access and capture bit patterns from the parallel
>port using Visual Basic?
>
>Steve
>
>PS...I have asked this same question in several programming newsgroups, but
>I have not recieved any responses.
>
>

I just had a wild idea that should do the trick in any version of
Windows, using VB or almost any language: Use the sound card!
You can set the sample rate to 44100 or 48000 Hz to get better
than 23 usec resolution. There is good language and API
support for recording. All you need is a way to encode the
8 channels onto one (or 2) analog input. The solution is to
make a really simple D/A converter. I'd recommend an R-2R
ladder type, since they are less sensitive to resistor tolerance
than a weighted resistor scheme. Now each channel will
produce it's own unique level, and each observed level will
be due to one and only one unique combination of inputs.

The sound card is AC coupled, so this only works for a
situation like yours, where the cars pass a detector and
produce a pulse that lasts a short time. Sound cards typically
go down to at least 20 Hz, so the waveform should be
pretty flat on top for the short duration of a car's passage.

If you have only one car pass it's detector at a time for
a "clear winner" situation, then you just get a pulse whose
height encodes which track it is. The duration tells you the
speed. If you get more than one car at a time, you will
have to decode the amplitude waveform, but I think this
will be pretty straightforward. (Certainly compared to
writing ring 0 drivers to use the parallel port!) And note
that this is "real-time" performance under Windows, which
is nearly impossible to get any other way, since the sound
card is doing all the heavy lifting.

Note that you will need to take care that you set the
mixer controls to the same settings each time. Windows
doesn't make this easy; you either get uncalibrated
sliders in the standard mixer, or you have to confront
the Mixer API... the most abominable interface in the
whole Windows menagerie. So you might want to
come up with a simple calibration scheme, where
you just run one car down the MSB lane and normalize
to the recovered pulse height.

Best regards,




Bob Masta
dqatechATdaqartaDOTcom

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
.



Relevant Pages

  • what a bust ( hydro wandering loose in th car )
    ... what a bust (hydro wandering loose in th car) ... that if you download th cutest transexual off one of these tgp's ... what s th name of that fuckin program that popped up? ... after learning all those windows specific ...
    (alt.linux)
  • Re: Reinstalling XP without CD
    ... > with the sound card. ... I seem to have lost my Windows XP home edition CD. ... I still have my car keys.. ...
    (microsoft.public.windowsxp.general)
  • Re: GM loses big-time
    ... They should have told their dealers tough shit when the dealers ... WIRE the damned car was completely wired with. ... the windows simply fell out of their tracks into the ... Thank you for contacting the Chevrolet Customer Assistance Center. ...
    (rec.boats)
  • Re: OPEN LETTER to MVPs here who deny problems
    ... And Linux runs on the same hardware that Windows does and will run ... I can afford Windows as you well know. ... I can even afford a car and I don't make $14k a week. ...
    (microsoft.public.windows.vista.general)
  • Re: OPEN LETTER to MVPs here who deny problems
    ... And Linux runs on the same hardware that Windows does and will run on hardware that can't handle the resource hungry little pig called Vista. ... You claim to make so much money you have to use a FREE OS and can't afford Windows? ... I can even afford a car and I don't make $14k a week. ...
    (microsoft.public.windows.vista.general)