Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 20 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
20
Dung lượng
882,31 KB
Nội dung
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... standard port addresses If a port exists, the program tests it to find out whether it's an SPP, 80 ParallelPort Complete Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark Programming Tools [lptdata] PortOAddress=888 PortlAddress=632 Port2 Address=0 Port3 Address=256 PortOType=ECP PortlType=SPP Port2 Type= Port3 Type=SPP PortOEnabled=-1 PortlEnabled=-1 Port2 Enabled=0 Port3 Enabled=-1... WritePrivateProfileString ("lptdata", "Port2 Type", Port( 2) PortType, IniWrite = WritePrivateProfileString ("lptdata", "Port3 Type", Port( 3) PortType, 'Port enabled? IniWrite = WritePrivateProfileString ("lptdata", "PortOEnabled", CStr (Port( 0) IniWrite = WritePrivateProfileString ("lptdata", "PortlEnabled", CStr (Port( l) IniWrite = WritePrivateProfileString ("lptdata", "Port2 Enabled", CStr (Port( 2) IniWrite = WritePrivateProfileString... the Port array to update the display Dim Index% Dim EcpModeValue% For index = 0 To 3 frmSelectPort lblAddress(Index) Caption = Hex$ (Port( Index) Address) + "h" If Port( Index) Enabled = True Then frmSelectPort optPortName(Index) Enabled = True frmSelectPort lblAddress(Index) Visible = True frmSelectPort lblType(Index) Caption = Port( Index) PortType frmSelectPort lbIType(Index) Visible = True If Port( Index)... the Port array to update the display Dim Index% Dim EcpModeValue% For index = 0 To 3 frmSelectPort lblAddress(Index) Caption = Hex$ (Port( Index) Address) + "h" If Port( Index) Enabled = True Then frmSelectPort optPortName(Index) Enabled = True frmSelectPort lblAddress(Index) Visible = True frmSelectPort lblType(Index) Caption = Port( Index) PortType frmSelectPort lbIType(Index) Visible = True If Port( Index)... WritePrivateProfileString ("lptdata", "Port2 Address", CStr (Port( 2) IniWrite = WritePrivateProfileString ("lptdata", "Port3 Address", CStr (Port( 3) Address), IniFile) Address), IniFile) Address), IniFile) Address), IniFile) 'The port types : IniWrite = WritePrivateProfileString ("lptdata", "PortOType", Port( 0) PortType, IniWrite WritePrivateProfileString ("lptdata", "PortlType", Port( 1) PortType, IniWrite = WritePrivateProfileString... True If Port( Index) PortType = "ECP" Then EcpModeValue = ReadEcpMode (Port( Index) Address) frmSelectPort cboEcpMode(Index) ListIndex = EcpModeValue Port( Index) EcpModeValue = EcpModeValue Port( Index) EcpModeDescription = GetEcpModeDescription(EcpModeValue) frmSelectPort cboEcpMode(Index) Visible = True Else frmSelectPort cboEcpMode(Index) Visible = False End If Else frmSelectPort optPortName(Index) Enabled... True If Port( Index) PortType = "ECP" Then EcpModeValue = ReadEcpMode (Port( Index) Address) frmSelectPort cboEcpMode(Index) ListIndex = EcpModeValue Port( Index) EcpModeValue = EcpModeValue Port( Index) EcpModeDescription = GetEcpModeDescription(EcpModeValue) frmSelectPort cboEcpMode(Index) Visible = True Else frmSelectPort cboEcpMode(Index) Visible = False End If Else frmSelectPort optPortName(Index) Enabled... Some EPPs support PS/2 mode, while other don't You should test for a PS/2-type port only after you've verified that a port exists at the address Because the PS/2 test uses the failure of a port read to determine that a port is bidirectional, a non-existent port will pass the test! Using the Port Information The program stores information about the ports in a user-defined array For each port, the array... computer, the port that a program accesses may change In this case, it's best to allow the software or user to select a port address while the program is running The Port Menu In Figure 4-l , the startup form contains a Port item in the Setup menu Clicking on Port brings up a form that enables users to find, test, and select ports Clicking on Find Ports causes the program to look for a port at each... existence of the Data port It doesn't test the Status and Control lines The other port types should also pass this test Detecting a PS/2-type Port If the port passes the SPP test, the final test is for simple bidirectional ability (PS/2-type) The program first tries to put the port in input mode by writing 1 to bit 5 in the port' s Control register (base address + 2) If the port is bidirectional,