GEOS SDK TechDocs
|
|
3 Using the Parallel Ports
|
3.2 Communicating
ParallelOpen()
To open a parallel port, call the routine
ParallelOpen()
. This routine is passed the following arguments:
GeodeHandle
of the parallel-port driver.
ParallelUnit
enumerated type; this specifies which parallel port is being opened. The type's members are PARALLEL_LPT1, PARALLEL_LPT2, PARALLEL_LPT3, and PARALLEL_COM4.
StreamOpenFlags
enumerated type, indicating what to do if the requested parallel port is busy (either STREAM_OPEN_NO_BLOCK, indicating that the routine should return an error immediately; or STREAM_OPEN_TIMEOUT, indicating that the routine should wait a specified number of clock ticks to see if the port will free up).
ParallelPortNums
.
A flag is returned to indicate whether the parallel port could be opened; if not, a value of type
StreamError
will be returned to indicate the reason. Possible stream error values are STREAM_BUFFER_TOO_LARGE and STREAM_CANNOT_CREATE, and the additional values STREAM_NO_DEVICE (if the parallel port does not exist) or STREAM_DEVICE_IN_USE (if the device is busy and the
StreamOpenFlags
passed indicate not to wait (or not to wait any longer)).
Note that when using the parallel driver, you do not identify the stream by a stream token but rather by the parallel port number, known as a unit number . When accessing a parallel port, you simply pass the port's unit number along with either STREAM_READ (if reading from the stream) or STREAM_WRITE (if writing to the stream); because each port has two streams associated with it, you must specify both parameters. The parallel driver will understand which stream you are accessing.
Once the port is selected, the PC will assert the SLCTIN signal, which usually will place the device on-line.
GEOS SDK TechDocs
|
|
3 Using the Parallel Ports
|
3.2 Communicating