[comp.sys.ibm.pc.misc] Using a PC to monitor an external signal

streeter@theory.lcs.mit.edu (Kenneth B. Streeter) (07/05/90)

I would like to use an ibm pc to monitor an external signal.  The
signal in question is from a single digital wire.  The signal on the
wire is essentially a square wave, from 0V to 5V, with an irregular
period.  The input signal frequency would never be above about 150 Hz.
Essentially, what I want to do is simply count cycles.  (Rising edges
of the wave, actually.)  It would be nice to be able to count LOTS of
these pulses (for about 8 hours).

Basically, I'm looking for ideas on how to do this.  I've got a few
ideas, but would like to see something relatively simple.

For those of you that may be a little more interested in the
application, this is for installation in a car.  The square wave is
from a wheel sensor which basically gives a cycle every time the wheel
rotates.  The count is counting wheel revolutions, which can be used
to calculate distance, speed, etc.  (Thus, it would be essential to
have a laptop capable of doing this.)

Thanks for any ideas.


--
Kenneth B. Streeter         | ARPA: streeter@im.lcs.mit.edu
MIT LCS, Room NE43-350      | UUCP: ...!uunet!im.lcs.mit.edu!streeter
545 Technology Square       | (617) 253-2614    (work)
Cambridge, MA 02139         | (617) 225-2249    (home)  

markd@silogic.UUCP (Mark DiVecchio) (07/05/90)

In article <1990Jul4.215014.29212@mintaka.lcs.mit.edu> streeter@im.lcs.mit.edu (Kenneth B. Streeter) writes:
>
>I would like to use an ibm pc to monitor an external signal.  The

Suggestion : there are several 'voice digitizer' programs around which
have the user build some external circuitry and connect it to a serial
port.  Then a program reads the port.  I believe that the external
circuitry converts the voice into 5 v pulses.  This scheme may be
modifiable for your use.  I have a file called "DIGITIZE.ZIP" on my BBS
at 619-549-3927.  A friend built the external circuit and it worked.  It
is cheap with Radio Shack parts. 

Good Luck. 

-- 
Mark DiVecchio, Silogic Systems, 619-549-9841                       K3FWT
-----   9888 Carroll Center Road, Suite 113, San Diego, CA 92126    -----
silogic!markd@fps.com                                    BBS 619-549-3927
...!ucsd!celerity!celit!silogic!markd     celerity!silogic!markd@ucsd.edu

wiml@milton.u.washington.edu (William Lewis) (07/05/90)

In article <1990Jul4.215014.29212@mintaka.lcs.mit.edu> streeter@im.lcs.mit.edu (Kenneth B. Streeter) writes:
>I would like to use an ibm pc to monitor an external signal.  The
>signal in question is from a single digital wire.  The signal on the
>wire is essentially a square wave, from 0V to 5V, with an irregular
>period.  The input signal frequency would never be above about 150 Hz.

   Since the signal is already nice, digital and 0-5 volts, you could try
just hooking it up to a parallel or serial port status line, and then
polling this line 300 times a second or whatever. Since this is in a car,
an opto-isolator might be a good idea too.
   The problem is that this would take most of the pc's time just polling
the line for worst-case behavior. It might be possible to hook it up to
the receive line on the serial port, and have the hardware generate
an "incoming character" interrupt on rising edges. The ISR could simply
increment a counter in memory somewhere, and the logger (or whatever
is looking at the info) could check this periodically.
   For a first try, you could connect it to the "busy" pin of the parallel
port (pin 11 on a Centronics connector) and use service 2 of int 23 to
poll it.

-- 
wiml@blake.acs.washington.edu       Seattle, Washington  | No sig under
(William Lewis)  |  47 41' 15" N   122 42' 58" W  |||||||| construction

jstone@world.std.com (Jeffrey R Stone) (07/06/90)

streeter@theory.lcs.mit.edu (Kenneth B. Streeter) writes:


>I would like to use an ibm pc to monitor an external signal.  The
>signal in question is from a single digital wire.  The signal on the
>wire is essentially a square wave, from 0V to 5V, with an irregular
>period.  The input signal frequency would never be above about 150 Hz.
>Essentially, what I want to do is simply count cycles.  (Rising edges
>of the wave, actually.)  It would be nice to be able to count LOTS of
>these pulses (for about 8 hours).

The serial port handshake signals make OK digital I/O ports (2 bits each
direction, per port) if you can arrange your signals to fit meet the 
voltage specs (0 to 12v, I think).  It sounds like you'd need only one
of the inputs.  Monitoring it wouldn't take much CPU power at < 150Hz.
A simple polling loop could maintain a pulse count, and by hooking the 
timer interrupt, you could do whatever count vs. time stuff you need to
do (just keep it short).  A 32 bit int can count to over 2 billion before
overflowing, even with a bit reserved for the sign.  That's 20 million
seconds at 100Hz, or about 8 months.  Should meet your requirements! :-)

-jeff-

hcooper@esunix.UUCP (Hardware Support) (07/07/90)

Can I ask why are you going to use a peeCee for this?  Kind of an
overkill, and slightly difficult aunless you plan to use a laptop.

Anyway, you might approach this in several ways.

1. Use a serial port and look for the INT line to toggle.

2.  Use the parallel port (some discussion was done on this already, and
a magazine had an article (RE I think) on doing this as well.

3. Use a small single board computer, like micromints or such.  It would
be pretty easy to writea small program for the 8051 to just read in the
pulses and do some quick calculations on it.  I just think a PC would be
a major overkill for this (granted a system would only run about $250
running on AC, adding about $100 for an inverter if mobile).

-- 
Evans & Sutherland Computer Corp.

streeter@theory.lcs.mit.edu (Kenneth B. Streeter) (07/09/90)

In article <2048@esunix.UUCP> hcooper@esunix.UUCP (Hardware Support) writes:

>Can I ask why are you going to use a peeCee for this?  Kind of an
>overkill, and slightly difficult aunless you plan to use a laptop.

Well, what I've asked about is just a portion of what I want to do.  I
want the PC (laptop) to be used in a car, as an time-speed-distance
rallying computer.  Depending on the class in which I want to compete,
it could be used solely as a clock & odometer, or, alternatively, as a
full-fledged rallying computer.  This involves a lot probably only of
interest to other rallyists, but essentially, there is a significant
amount of programming required -- something which a microprocessor
would be needed for, however a single-board micro would be sufficient.
The primary advantage of the laptop, however, is that it doesn't have
to be used ONLY for rally computing.  (Insert typical laptop uses
here.)

I've gotten a couple of replies about this so far.  I've found an IBM
Technical Reference manual which explains how to use the
serial/parallel ports.  Does anyone have any similar applications that
I could have source code for to see how one actually uses the ports in
a program?  

Thanks,
--
Kenneth B. Streeter         | ARPA: streeter@im.lcs.mit.edu
MIT LCS, Room NE43-350      | UUCP: ...!uunet!im.lcs.mit.edu!streeter
545 Technology Square       | (617) 253-2614    (work)
Cambridge, MA 02139         | (617) 225-2249    (home)