VIEWER(OPCSDEFS)	Optical Printer Control System       VIEWER(OPCSDEFS)

    NAME
        viewer - configure the viewer input port and bit mask

    USAGE
        viewer [port] [mask] [test] [0]    # (all values in hex!)

    EXAMPLES
        viewer 0000 00 00	 # No viewer detection
        viewer 03bd 40 40	 # LPT1 pin 10, HI bit detects condition
        viewer 03bd 40 00	 # LPT1 pin 10, LO bit detects condition

    DESCRIPTION
       If your system has a 'viewer open' switch, it can be wired to one of 
       the IBM parallel ports to allow the software to sense its state, to
       prevent exposing film with the viewer open.

	[port] is the port number in the range 0000-03ff.
	If [port] is 0000, no viewer checking is done.

	[mask] is applied to the value received from the port 
	whenever the software is checking for a viewer open condition.
	This is applied before comparing to [test].

	[test] is compared to the value read from the port after
	[mask] is applied. If the result is the same as [test], a viewer open
	condition exists.

    WIRING CONSIDERATIONS
        Normally you would use an optically isolated interface card for the
        buckle and viewer switches, e.g. PIO-100(DOCS).

        If directly connecting switches to the parallel port, use a separate
        dedicated 5 VDC power supply wired through the switches such that
        when the sensing switch is tripped, +5V is supplied to the computer.

        Such a supply can be a store-bought 5 VDC regulated switching 
        transformer, which gives out *exactly* 5VDC. (Avoid older linear
        transformers, as they are often unregulated)

        As with any signal going to the sensing input on a computer, the
        signal should never be open. The signal must pull either 5 volts 
        or ground for a TRUE or FALSE condition. Open inputs can act like
        radio antennas that will oscillate randomly.

        If you have noise problems, shielded wire can help mitigate noise.
        Shield ONLY at the power supply end. Ground the shield to chassis
        ground if possible.  Keep wire lengths as short as possible.

        If noise problems persist, it may be that the wire is simply too
        long for such a low voltage signal. The PIO-100 uses 12VDC to allow
        for longer cable lengths, and an optoisolator to convert to +5V for
        the parallel port input.

        You can find the base port value for the parallel ports from the
        operating system using the DOS 'debug' utility:

        C>debug                               # run 'debug'
        -d40:8 f                              # enter this (not the '-')
        0040:0008  BC 03 78 03 00 00 00 00    # debug spits this out
        -q         ----- -----                # type 'q' to quit debug
                     |     |
                     |     LPT #2's  port base address
                     |
                     LPT #1's  port base address

        Your machine may show different values. In the case above, 03BC
        is the base port value for LPT1..note the bytes are in reverse
        order in typical LSB/MSB fashion.

        See the PARALLEL() man page which shows the pin out and port addresses
        of the IBM PC's parallel ports.

    BUGS
    	None.

    SEE ALSO
        DEENERGIZE(OPCSDEFS)  - define port/bit to deenergize motors
        ALLSTOP(OPDSDEFS)     - define port/bit to detect the allstop key
        BUCKLE(OPCSDEFS)      - define port/bit to detect film buckles
        VIEWER(OPCSDEFS)      - define port/bit to detect viewer open
        TRIPSWITCH(OPCSDEFS)  - define port/bit to detect trip switches
        SETBIT(OPCSDEFS)      - set bit(s) on a port
        CLRBIT(OPCSDEFS)      - clear bit(s) on a port
        XORBIT(OPCSDEFS)      - invert bit(s) on a port
    	PARALLEL(BIOS)	      - parallel port pinout with port/bit masks
        PIO-100(DOCS)         - OPCS Parallel I/O interface board, e.g.
                                http://seriss.com/opcs/pio-100/

    ORIGIN
	Version K1.12e+ Gregory Ercolano, Venice California 04/10/98
© Copyright 1997 Greg Ercolano. All rights reserved.