Home    Prev Next    
Contents
Programming For Parallel Port Device
Overview
Programmers Guide
Scenario
I/O Ports control
Single read/write operations
Data array read/write operations
Hardware interrupts handling at user level
Common Issues
LPT Support Routines
Common Procedures
OpenRapidLpt
IsRapidLptOpened
CloseRapidLpt
OpenPort
ClosePort
GetNumLPTs
GetPortNumber
GetReadMode
SetReadMode
LPT specific functions
Parallel port info
GetBasePortAddress
GetBaseSpan
GetEcpAddress
GetEcpSpan
GetInterruptVector
GetInterruptLevel
GetInterruptAffinity
GetInterruptMode
Parallel port registers
GetDataPort
SetDataPort
GetStatusPort
SetStatusPort
GetControlPort
SetControlPort
GetEcrPort
SetEcrPort
GetEPPAddressPort
SetEPPAddressPort
GetEPPDataPort
SetEPPDataPort
Centronix signals
GetLptBusy
GetLptPaperEnd
GetLptSlct
GetLptAutofd
SetLptAutofd
GetLptError
LptInit
LptSelectIn
GetPrinterReady
Parallel port modes
GetCurrentLptMode
SetCurrentLptMode
GetIsPresent
GetIsPS2Present
GetIsEcpPresent
Work with pins
GetPin
SetPin
Work with bits
GetDataPortBit
SetDataPortBit
GetStatusPortBit
SetStatusPortBit
GetControlPortBit
SetControlPortBit
GetCfgaPortBit
SetCfgaPortBit
GetCfgbPortBit
SetCfgbPortBit
GetEcrPortBit
SetEcrPortBit
Direct Port I/O
GetPortByte
GetPortWord
GetPortLong
SetPortByte
SetPortWord
SetPortLong
ReadPortBuffer
WritePortBuffer
Hardware Interrupts
UnmaskLptIrq
MaskLptIrq
GetInterruptCounter
Scenario
Go to RapidDriver Main Page

Before using any of the functions of RapidLpt, the driver must be initialized with the help of the function OpenRapidLpt . It must be done once after starting the application. Also resources used by the driver should be cleaned up(driver closed) before the application is closed.

Schematic session of using RapidLpt:
 
// initialize(open) the driver  
 
hLpt =  OpenRapidlpt( 0 );   
 
// Check if the driver initialized successfully  
 
if ( IsRapidLptOpened(hLpt)) {   
     ...   
//////////////////////////////////////  
/////////  RapidLpt session //////////  
/////////  ................ //////////  
//////////////////////////////////////  
 
// Free resources used by the driver (close the driver)           
 
hLpt = CloseRapidLpt(hLpt);   
 
}  
else    
{  
// An error happened while opening the driver  
MessageBox("Cannot open the driver","Attention!", MB_OK | MB_ICONWARNING);     
}  

Driver can be initialized by many applications simultaneously, once for each LPT device. The parameter of OpenRapidLpt() can be used to select a device supported by RapidLpt driver.