TENSION(OPCSDEFS)	Optical Printer Control System	  TENSION(OPCSDEFS)

    NAME
        tension - configure tension motor port for each channel

    USAGE
        tension [chan] [port] [mask] [invert] [softlatch]    # (values hex!)

    EXAMPLES
        tension a 03bc 01 00 0        # lpt1 output port bit #1
        tension a 0306 01 00 1        # kuper card logic connector
                                      # bit #1 (note softlatch=1)

    DESCRIPTION
        This command defines the port bit that controls the direction for
	the tension motors on the specified channel.

	Intended only for camera, main and aerial projector channels,
	a change in the set/clear state of the bit should toggle between
	full power for the take up and feed motors.
	
	[chan] is the channel name of the motor to be affected.

	[port] is the port number. If [port] is 0000, 
	this feature is disabled.

	[mask] is the bit number in the port that is flipped
	according to the direction the channel's motor is running.
	
	[invert] if set to '0', running the motor forward clears
	the [port] bit specified in [mask], and reverse sets the bit. 
	If [invert] is '1', the opposite happens; forward sets the bit,
	reverse clears it.

        [softlatch] is 0 or 1. Set to '0' for a normal I/O port where
	reading the port returns the hardware bits last set.  Set to '1' if 
	the port is "write only", where the software internally maintains the
	state of which bits have been set, to avoid ever reading the port.
	The Kuper logic port needs this; its OUTPUT port (usually at 0306)
	is also the logic INPUT port, depending on if its read or written. 
	In order for the software to change one of the 8 bits on the port,
	the software must know the settings of the other 7 bits, in order
	to maintain them when changing bits.
	
    BUGS
        o With [softlatch] set to 1, only ports 0x0000 - 0x07ff are allowed.
	  Any ports referenced above 0x07ff with [softlatch] enabled will
	  cause an error.

        o External programs that modify a port defined to OPCS as a [softlatch]
	  port (such as would be the case for the kuper logic I/O port) should
	  beware that the OPCS software will be maintaining it's own internal
	  latch for that port, and this latch value will not reflect any 
	  changes that have been made by the external program.
	
	  This is not really a bug, just a fact that cannot be changed. It 
	  is usually bad hardware practice to make WRITE ONLY ports, since 
	  different programs cannot co-communicate with such a port, unless 
	  some common data area is arranged to latch the settings, which can
	  be hard to enforce on PCs.

    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

    ORIGIN
	Gregory Ercolano, Los Feliz California 09/11/90
© Copyright 1997 Greg Ercolano. All rights reserved.