📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 3030
ClientLeft = 675
ClientTop = 3795
ClientWidth = 4005
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3030
ScaleWidth = 4005
ShowInTaskbar = 0 'False
Begin VB.TextBox Text2
Height = 270
Left = 1560
TabIndex = 4
Top = 1800
Width = 1575
End
Begin VB.CommandButton Command2
Caption = "Write"
Height = 375
Left = 2280
TabIndex = 3
Top = 2400
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "Read"
Height = 375
Left = 480
TabIndex = 2
Top = 2400
Width = 1215
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form1.frx":0000
Left = 1560
List = "Form1.frx":000D
TabIndex = 1
Text = "378"
Top = 360
Width = 1455
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Form1.frx":0020
Left = 1560
List = "Form1.frx":0030
TabIndex = 0
Text = "PA"
Top = 1080
Width = 1455
End
Begin VB.Label Label3
Caption = "DATA"
Height = 255
Left = 480
TabIndex = 7
Top = 1920
Width = 735
End
Begin VB.Label Label2
Caption = "Base Address"
Height = 255
Left = 360
TabIndex = 6
Top = 360
Width = 1335
End
Begin VB.Label Label1
Caption = "PORT"
Height = 255
Left = 480
TabIndex = 5
Top = 1200
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Value, PortAddress, Offset As Integer
Dim Port As String
Private Sub Combo1_Click()
Port = Combo1.Text
If Port = "PA" Then
Offset = 0
End If
If Port = "PB" Then
Offset = 1
End If
If Port = "PC" Then
Offset = 2
End If
If Port = "Control" Then
Offset = 0
End If
End Sub
Private Sub Combo2_Click()
PortAddress = Combo2.Text
Out Val("&h" + Combo2.Text) + &H402, &H80 'set ecr,use EPP mode
Out Val("&h" + Combo2.Text) + &H2, 0 'control port output pull high
Out Val("&h" + Combo2.Text) + &H3, 3 'output address select control word register
Out Val("&h" + Combo2.Text) + &H4, &H80 'output control word register data
End Sub
Private Sub Command1_Click()
Out Val("&h" + Combo2.Text) + &H3, Offset 'use 8255 porta
Text2.Text = Hex$(Inp(Val("&h" + Combo2.Text) + &H4))
End Sub
Private Sub Command2_Click()
Out Val("&h" + Combo2.Text) + &H3, Offset 'use 8255 porta
Out Val("&h" + Combo2.Text) + &H0, Val("&H" + Text2.Text)
End Sub
Private Sub Form_Load()
Value = 0
Offset = 0
PortAddress = Combo2.Text
Out Val("&h" + Combo2.Text) + &H402, &H80 'set ecr,use EPP mode
Out Val("&h" + Combo2.Text) + &H2, 0 'control port output pull high
Out Val("&h" + Combo2.Text) + &H3, 3 'output address select control word register
Out Val("&h" + Combo2.Text) + &H4, &H80 'output control word register data
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -