Waterloo Instruments

 

DIN-64 64-line Digital Input

 

User’s Manual

 

[RH1] 
Package Contents

Your package should include:

·         DIN-64 Interface

·         9VDC Power Supply Adapter

·         Eight TB-10 Terminal Boards

·         Sixteen 10-pin crimp-on ribbon-cable connectors

·         32 feet of 10-pin ribbon-cable

·         One software disk

·         This manual

 

You must supply:

·         A standard IBM-PC printer cable

Overview

The DIN-64 connects to a host computer through the parallel printer port.  It allows the computer to monitor up to 64 external digital signals.

 

The 64 inputs are divided into groups of eight inputs each.  Each group of eight inputs has its own connector on the front panel.  Each input is identified by a two-digit number.  The first digit specifies which connector the input is on, and ranges from 0 to 7.  The second digit identifies the input within that connector, and ranges from 0 to 7.

 

Thus, the first eight inputs are numbered 00, 01, …, 07.  The next eight inputs are 10, 11, …, 17.  The last eight inputs are 71, 72, …, 77.

Hardware Installation and Setup

Input Specifications

The DIN-64 allows your computer to receive and process digital signals from the outside world.   The device operates on 5V TTL inputs.  This means that a voltage below +0.8V (relative to ground) is interpreted as a ‘0’, while a voltage of +2V or greater is a ‘1’.  Voltages in between are indeterminate, and could be read either way.  Any input left unconnected (“floating”) also gives an indeterminate reading (but see pull-up and pull-down modes, below).

 

Input voltages exceeding +7V could damage the DIN-64.  Typically, you should stay at or below +5V.  Similarly, negative voltages (relative to ground) should also be avoided.

Input Configurations

The 64 digital inputs on the DIN-64 can be configured to operate in three modes.  These are pull-up mode, pull-down mode, and open-mode.  Your choice of input mode is influenced by the design of your external signal sources.

 

In open-mode, the input signals are interpreted directly without any further processing or conditioning.  This is suitable if your sensing devices can apply 0V and +5V to the inputs.  This can be difficult to arrange when the sensors are switches.  An SPDT-type switch can provide this type of signal, but it requires three wires to each switch.  This diagram shows this type of connection:

Figure 1: Three-wire SPDT connection (open mode)

The pull-up and pull-down modes provide a simpler way to interface the DIN-64 with switches, allowing the use of simpler SPST-type switches.  In these modes, each input is connected internally to either ground (pull-down mode) or +5V (pull-up mode).  This means that, when left unconnected, the input will read as ‘0’ (pull-down mode) or ‘1’ (pull-up mode).  However, an external signal can override the pull-up or pull-down resistors, and force the input to the other state.

 

When using pull-up or pull-down mode, it is possible to use SPST-switches with only two wires run to each switch, and one of those two wires can be common to all switches.  Here is an example showing three switches connected to the DIN-64 in pull-up mode:

Figure 2: Two-wire SPST connection (pull-up mode)

In pull-up mode, the inputs will read as ‘1’, except when the switch is closed.   Pull-down mode would be similar, except the common side of the switches would be wired to +5V, and closing a switch would change a ‘0’ input to a ‘1’.

 

The DIN-64 is shipped pre-configured for pull-up mode operation.

Changing the Input Mode

The inputs can be configured for pull-up, pull-down or open-mode in groups of eight, corresponding to the eight connectors on the front panel.  Reconfiguring the inputs requires disassembling the unit.

 

As always when working with electronics, it pays to take precautions against static electricity, which can damage sensitive components.  Ideally, you should wear a specially made static-dissipative wrist-strap connected to a good ground point, and do your work on a static-dissipative surface.

 

Here are the steps required to disassemble the unit:

1.        Disconnect the power and PC cables.

2.        Turn the DIN-64 upside down, and remove the two screws holding the case together.

3.        Separate the two halves of the case, and remove the circuit-board assembly.

4.        The circuit-board assembly consists of two boards, a main board, containing four input connectors, and the power and host PC connectors, and a smaller daughter board containing four more input connectors.  These boards are held together by three bolts, three tubular spacers, and three nuts.  A line of square pins forms the electrical connection between the boards.  Remove the three nuts, and pull the boards apart, being careful not to bend or stress the electrical connection.

 

The input mode is configured by SIP (single inline package) resistors installed in sockets on the circuit-board.  These are long rectangular components with 10 pins.  There are eight of them on the board, installed in sockets adjacent to the eight input connectors.  Four of them are on the main circuit-board (corresponding to input 00 through 37), and the other four are on a daughter-board (inputs 40 through 77).

 

To select the ‘open’ input mode, remove the SIP resistor.  Carefully pry it out, being careful to bend the pins.  To avoid losing it, secure it to the inside of the case using a bit of tape.

 

To select pull-up or pull-down modes, the SIP resistors must be installed in a particular orientation, according to the following diagrams.  Pin 1 on the SIP is identified by a mark, depression or notch on one end of the package.

Figure 3: Selecting pull-up mode

 

Figure 4: Selecting pull-down mode

 

Reassemble the unit by reversing the steps for disassembly.

Connecting to the Computer

1.        Connect a standard IBM-compatible printer cable to the printer port (a 25-pin female connector) on the back of the computer.

2.        Connect the other end of the printer cable to the host PC connector on the DIN-64.  Pull the locking tabs together so they latch into the printer cable.

3.        Plug the 9VDC adapter into a free AC outlet, and plug the DC power cable into the power jack on the DIN-64.

Input Connector Pinouts

The input connectors have ten pins each.  This table shows the pin assignments on the connectors:

Figure 5: Input connector

 

Pin Number

Description

1

+5V

2

Input x0

3

Input x1

4

Input x2

5

Input x3

6

Input x4

7

Input x5

8

Input x6

9

Input x7

10

GND

Connecting the Terminal Boards

The 10-pin connectors on the DIN-64 are compact, but inconvenient for making connections to switches.  The DIN-64 comes with eight terminal boards, equipped with easy-to-use screw terminals.  These terminal boards can be mounted (by #4-40 screws) near the actual switches.  A single ribbon cable then carries the signals from the terminal board back to the DIN-64.

 

The package includes ?? feet of ribbon cable and ?? crimp-on ribbon-cable connectors so you can make your own cables in the lengths you require.  Creating your own cables is easy:

1.        Measure out the length of cable you need to reach from the DIN-64 to the terminal board.

2.        Using a sharp knife or scissors, cut the cable to that length.  Try to make the cut at square to the cable.

3.        Ready one of the crimp-on connectors.  Examine it to find the marking identifying pin ‘1’.  This is usually indicated by a small triangle on the side of the connector.

4.        Find conductor ‘1’ on the ribbon-cable.  Typically, ribbon-cables are grey, with one edge coloured red or black.  This indicates conductor ‘1’.  Some ribbon-cables are rainbow-coloured.  In this case, just decide for yourself which edge will be ‘1’.

5.        Insert the ribbon cable into the connector so that conductor ‘1’ is aligned with pin ‘1’ on the connector.  The cable should be inserted far enough that it is flush with the opposite side of the connector.

6.        While keeping the connector perpendicular to the cable, gently compress the connector with a pair of pliers or a small vise.  Compress it until the sharp metal fingers pierce the cable’s insulation, and the connector clicks.

7.        Repeat steps 4 through 6 using another crimp-on connector on the other end of the cable.  Be careful that you keep pin ‘1’ matched up with pin ‘1’ on the other end.

 

Additional ribbon-cable or connectors can be obtained from many electronics suppliers (but Radio Shack is probably not one of them).  Newark Electronics (1-800-4-NEWARK, http://www.newark.com) and Digi-Key (1-800-344-4539, http://www.digikey.com) are good examples.  Here are the specifications you’ll need:

·         10-conductor flat-cable, 0.050” pitch, 28-guage stranded conductors.  E.g., Thomas&Betts type 201-10, Newark Electronics stock #16F198.

·         10-pin flat-cable connector, 0.1”x0.1” spacing, center-bump polarizing.  E.g., Thomas&Betts type 636-1030, Newark Electronics stock #52F7007.

Software

The following files are included on the software diskette:

DIN-64 Monitor

DIN64_Monitor is a simple utility that displays the current state of all 64 input lines.  It can be used to test the DIN-64.

 

The Visual Basic 5.0 source code for this utility is also included, as sample code showing how to program the DIN-64.

PORTIO Library

The PORTIO library provides a simple way to access the DIN-64 from Visual Basic.  The disk includes the PORTIO.DLL file, as well as the C source code for the DLL and PORTIO.BAS, a Visual Basic file that defines the interface to the PORTIO routines.

Programmers’ Guide

Overview

To read an input line using the DIN-64, two steps are required.  First, you must select which switch you want to read.  Then, you read the state of that input.

 

In all environments, the inputs are identified by a number from 0 to 63.  The input selection must be written to the printer-port data register.  The input state is then read from the printer-port status register.  The input state appears in bit 7 of that register (the BUSY bit).

 

This table gives the IO addresses of the registers, depending on which printer port you are using:

 

Port

Data

Status

LPT1

$378

$379

LPT2

$278

$279

C or C++

If you are programming in C or C++ for DOS, Windows 3.1, or Windows 95, accessing the ports is quite easy.  The input is selected using the “outp()” library function.  The input state is read using the “inp()” function.  Both of these functions are declared in the Microsoft or Borland C “conio.h” header file.

 

Here is some sample code (suitable for DOS or a console application under Windows 95) showing how to poll all the inputs:

 

#include <stdio.h>

#include <conio.h>

 

void main() {

    unsigned switch;

    for( ; ; ) {

        for( switch = 0; switch < 64; ++switch ) {

            outp( 0x378, switch );

            if( inp( 0x379 ) >= 128 )

                printf( “Switch %u on.\n”, switch );

            else

                printf( “Switch %u off.\n”, switch );

        }

    }

}

Visual Basic

Things are trickier in Visual Basic.  Visual Basic has no equivalent to the C “inp()” and “outp()” functions.  Fortunately, it does have the capability to call subroutines written in other languages, if those routines are packaged in the form of DLLs.  The DIN-64 software disk includes “PORTIO.DLL”, which will give Visual Basic programs a facility equivalent to the C “inp()” and “outp()” routines.  Another file, PORTIO.BAS, is also provided.  It contains Visual Basic statements to import the PORTIO.DLL routines into the Visual Basic environment.

 

To use PORTIO.DLL, copy the PORTIO.DLL and PORTIO.BAS files into your Visual Basic project directory.  Add the PORTIO.BAS file to your project, by selecting “Add Module” in the “Project” menu.  Select the existing module, PORTIO.BAS.

 

Once that is done, your Visual Basic code will be able to use the following subroutines: Inp, Inpw, Inpd, Outp, Outpw, and Outpd.  These all work the same as the C standard library routines.

Theory of Operation

The DIN-64 is simply a 64-to-1 multiplexer.  The binary value presented on the low six printer data lines (pins 2 through 7 on the 36-pin Centronics printer connector) selects the desired input.  The signal from that input is routed to the printer ‘BUSY’ line (pin 11 on the Centronics connector).

 

The 64-to-1 is implemented by a two-level tree of 74LS151 8-to-1 multiplexers.  At the first level, one 74LS151 selects one of eight data lines, and routes it to the BUSY pin.  This multiplexer is controlled by the data bit 3, 4, and 5.  Each of the eight inputs to that multiplexer is connected to the output of another 74LS151.  Data bits 0, 1 and 2 control all eight of the second-level multiplexer simultaneously. 

 

The inputs to the second level multiplexer come directly from the front-panel connectors.  Each group of eight inputs shares a single SIP resistor pack, containing eight resistors 3.3kW with one side of all the resistors common.  This common pin can be connected to either GND or +5V, depending on the orientation of the resistor pack in its socket, to provide the “pull-up” and “pull-down” modes.  In addition, the resistor packs can be removed entirely, to provide the “open” input mode.

 

Finally, a simple 7805 three-terminal voltage regulator IC and filter capacitors provide power for the logic chips.

 


 [RH1]