This is the code for a simple cable tester for multipolar cables where
the two ends are not in physical proximity; examples include
network/phone cables etc. The tester is made of two
modules: a sender, and a receiver, both based on a PIC.

    (C) 1996 Maurizio Fabbri, Fabio Raso, Luigi Rizzo
    Dipartimento di Ingegneria dell'Informazione
    via Diotisalvi 2 -- 56126 PISA (ITALY)
    email: luigi@iet.unipi.it

PRINCIPLE OF OPERATION

The tester uses N>=2 wires. In turn, each of the wires is used by
the sender as a hot (H) wire, while the others are used as return
wires.

The sender module sweeps cyclically all the wires by sending
a different code on each of them (a code is a bit pattern representing
the wire index). The resulting pattern on each wire is made of a
period of inactivity followed by the transmission of the code.

The receiver scans all the wires, waiting for the idle period, and
then trying to identify the code. Once all wires are processed, the
output can be produced by displaying the connection between wires at
the two ends.

MORE DETAILS

The current version of the tester uses just a PIC on each module,
thus limiting to 8 wires. In order for the tester to work, it is
necessary that at least two wires are connected in the cable
(otherwise, the tester reports wires as disconnected).

On the sender, wires are directly connected to the PIC's port B pins.
The hot wire is configured as an output, whereas the return wires are
configured as inputs and pulled up with an external resistor (about 1KOhm). 

On the receiver, wires go to port B pins through a current-limiting
resistor (5 KOhm). This is to protect inputs and to avoid conflicts
when portB is used to display results.

The output is reported as a sequence of 2 digits: the first one
reports the wire on the receiver, the second one the wire on the
sender. For the latter, three special symbols are used to signal that
the wire is stuck low, stuck high (or unconnected) or noisy.

The testing process is quite fast (and could become faster). Each code
is sent as an 8-bit pattern lasting 224us (28us/bit), so a full sweep
takes 1.8ms. The receiver needs 1 sweep/wire to make a complete test,
so test results are available in about 15ms.

SCHEMATICS

schematics are in the "tester.gif" file
          
TODO

+ if wires are connected together, report all the wires in addition
  to the first one (requires a simple extension to the software -
  operating time remains the same).
+ if wires are connected to the receiver side only, report them
  as connected together (requires a simple extension to the software -
  operating time increases by a very little amount).
+ extend the tester to more than 8 wires (requires using external
  analog multiplexers, e.g. CD4051 1-to-8). The operating time is
  proportional to N*N, in the case of 64 wires it is still about 0.5s
+ make the tester report results over an RS232 line.

A tester for 64 requires 1 PIC, eight 8-to-1 mux on each
sender/receiver, plus 4 displays on the receiver.

