Functions > di_set_port_mode

Syntax 

The di_set_port_mode function sets the printer port mode.

Note: Since calling di_open configures the parallel port in the fastest mode for which the device returns a signature, only use di_set_port_mode when you want to set the port to a slower mode.

Syntax 

int di_set_port_mode(mode);

unsigned mode;

/* sets the printer port mode */

Parameters

mode

mode = 0 returns the current mode

mode = 1 sets the printer port to EPP

mode = 2 sets the printer port to Bi-directional

mode = 3 sets the printer port to Standard

Return Value

The return value is the current mode (1, 2, or 3) or:

0 = EPP mode invalid for port with less than five contiguous I/O addresses

4 = Attempt to set EPP mode for a DI-220 series device.

Dependencies

di_open

Remarks

Windows XP accesses parallel ports every five seconds to determine if a device is attached using commands that disable DI-220 Series devices. Programs using the SDK for DI-220 series devices should be run from a batch file that runs 220LDRNT loader first or execute the 220LDRNT loader with appropriate command line arguments before calling di_open and retry if di_open fails.

Sample Code

di_open(1);

/* for a device on port LPT1 */

di_set_port(2);

/* use an EPP port like a port in bidirectional mode */

 

Copyright © DATAQ Instruments, Inc.