⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 stepper motor controller using vb through parallel port
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Stepper Motor Controller"
   ClientHeight    =   6360
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7605
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   MousePointer    =   4  'Icon
   PaletteMode     =   2  'Custom
   ScaleHeight     =   6360
   ScaleWidth      =   7605
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Tag             =   "012"
   WhatsThisHelp   =   -1  'True
   Begin VB.CommandButton Command6 
      Caption         =   "stop"
      Height          =   615
      Left            =   6120
      TabIndex        =   30
      Top             =   5280
      Width           =   1335
   End
   Begin VB.CommandButton Command5 
      Caption         =   "start"
      Height          =   615
      Left            =   4440
      TabIndex        =   29
      Top             =   5280
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Clear Port"
      Height          =   615
      Left            =   4440
      TabIndex        =   28
      Top             =   4560
      Width           =   1935
   End
   Begin VB.PictureBox Picture5 
      BackColor       =   &H00FFFFFF&
      Height          =   2775
      Left            =   4080
      ScaleHeight     =   2715
      ScaleWidth      =   2715
      TabIndex        =   27
      Top             =   480
      Width           =   2775
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   4560
      TabIndex        =   26
      Text            =   "Text2"
      Top             =   3960
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   4560
      TabIndex        =   25
      Text            =   "Text1"
      Top             =   3360
      Width           =   1095
   End
   Begin VB.Frame Frame3 
      Caption         =   "Direction"
      Height          =   615
      Left            =   600
      TabIndex        =   22
      Top             =   3480
      Width           =   3015
      Begin VB.OptionButton Option7 
         Caption         =   "Anti-Clockwise"
         Height          =   255
         Left            =   1560
         MousePointer    =   1  'Arrow
         TabIndex        =   24
         Top             =   240
         Width           =   1335
      End
      Begin VB.OptionButton Option6 
         Caption         =   "Clockwise"
         Height          =   195
         Left            =   240
         TabIndex        =   23
         Top             =   240
         Width           =   1095
      End
   End
   Begin VB.Timer Timer5 
      Interval        =   1
      Left            =   120
      Top             =   2040
   End
   Begin VB.Frame Frame2 
      Caption         =   "Value at Port"
      Height          =   975
      Left            =   600
      TabIndex        =   9
      Top             =   4560
      Width           =   3015
      Begin VB.PictureBox Picture4 
         Height          =   255
         Left            =   2280
         ScaleHeight     =   195
         ScaleWidth      =   195
         TabIndex        =   14
         Top             =   240
         Width           =   255
      End
      Begin VB.PictureBox Picture3 
         Height          =   255
         Left            =   1680
         ScaleHeight     =   195
         ScaleWidth      =   195
         TabIndex        =   13
         Top             =   240
         Width           =   255
      End
      Begin VB.PictureBox Picture2 
         Height          =   255
         Left            =   1080
         ScaleHeight     =   195
         ScaleWidth      =   195
         TabIndex        =   12
         Top             =   240
         Width           =   255
      End
      Begin VB.PictureBox Picture1 
         AutoRedraw      =   -1  'True
         Height          =   255
         Left            =   480
         ScaleHeight     =   195
         ScaleWidth      =   195
         TabIndex        =   11
         Top             =   240
         Width           =   255
      End
      Begin VB.Label Label6 
         Alignment       =   2  'Center
         Caption         =   "0"
         Height          =   255
         Left            =   2280
         TabIndex        =   18
         Top             =   600
         Width           =   255
      End
      Begin VB.Label Label5 
         Alignment       =   2  'Center
         Caption         =   "0"
         Height          =   255
         Left            =   1680
         TabIndex        =   17
         Top             =   600
         Width           =   255
      End
      Begin VB.Label Label4 
         Alignment       =   2  'Center
         Caption         =   "0"
         Height          =   255
         Left            =   1080
         TabIndex        =   16
         Top             =   600
         Width           =   255
      End
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "0"
         ForeColor       =   &H80000008&
         Height          =   375
         Left            =   480
         TabIndex        =   15
         Top             =   600
         Width           =   255
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Controls"
      Height          =   2895
      Left            =   600
      TabIndex        =   0
      Top             =   360
      Width           =   3015
      Begin VB.CommandButton Command3 
         Caption         =   "Start"
         Height          =   495
         Left            =   1440
         TabIndex        =   7
         Top             =   360
         Width           =   975
      End
      Begin VB.CommandButton Command2 
         Caption         =   "Stop"
         Enabled         =   0   'False
         Height          =   495
         Left            =   1440
         TabIndex        =   6
         Top             =   1200
         Width           =   975
      End
      Begin VB.CommandButton Command4 
         Caption         =   "Exit"
         Height          =   495
         Left            =   1440
         TabIndex        =   5
         Top             =   2040
         Width           =   975
      End
      Begin VB.OptionButton Option1 
         Caption         =   "100"
         Height          =   375
         Left            =   240
         TabIndex        =   4
         Top             =   840
         Width           =   1095
      End
      Begin VB.OptionButton Option2 
         Caption         =   "200"
         Height          =   375
         Left            =   240
         TabIndex        =   3
         Top             =   1320
         Width           =   1095
      End
      Begin VB.OptionButton Option3 
         Caption         =   "300"
         Height          =   375
         Left            =   240
         TabIndex        =   2
         Top             =   1800
         Width           =   1095
      End
      Begin VB.OptionButton Option4 
         Caption         =   "400"
         Height          =   495
         Left            =   240
         TabIndex        =   1
         Top             =   2160
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "Frequency of pulse"
         Height          =   495
         Left            =   240
         TabIndex        =   8
         Top             =   360
         Width           =   1095
      End
   End
   Begin VB.Timer Timer4 
      Enabled         =   0   'False
      Interval        =   500
      Left            =   120
      Top             =   1560
   End
   Begin VB.Timer Timer3 
      Enabled         =   0   'False
      Interval        =   500
      Left            =   120
      Top             =   1080
   End
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   500
      Left            =   120
      Top             =   600
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   500
      Left            =   120
      Top             =   120
   End
   Begin VB.Label Label9 
      Caption         =   "Decimal value at port  ="
      Height          =   255
      Left            =   960
      TabIndex        =   21
      Top             =   5760
      Width           =   1695
   End
   Begin VB.Label Label8 
      Caption         =   "0"
      Height          =   255
      Left            =   2760
      TabIndex        =   20
      Top             =   5760
      Width           =   255
   End
   Begin VB.Label Label7 
      Caption         =   "Label7"
      Height          =   375
      Left            =   600
      TabIndex        =   19
      Top             =   0
      Width           =   15
   End
   Begin VB.Label Label2 
      Caption         =   "Pulse At the Port (OX378)"
      Height          =   255
      Left            =   600
      TabIndex        =   10
      Top             =   4200
      Width           =   2055
   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 i As Integer
Dim j As Integer
Dim k As Integer
Dim p As Integer
Private Sub Command1_Click()
Out 888, 0
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Command3.Enabled = True
Command2.Enabled = False
End Sub

Private Sub Command3_Click()
Timer1.Enabled = True
Command2.Enabled = True
Command3.Enabled = False
End Sub

Private Sub Command4_Click()
End
End Sub



Private Sub Command5_Click()
p = 4
End Sub

Private Sub Command6_Click()
p = 0
End Sub

Private Sub Option1_Click()
Timer1.Interval = 1
Timer2.Interval = 1
Timer3.Interval = 1
Timer4.Interval = 1
End Sub

Private Sub Option2_Click()
Timer1.Interval = 200
Timer2.Interval = 200
Timer3.Interval = 200
Timer4.Interval = 200
End Sub

Private Sub Option3_Click()
Timer1.Interval = 300
Timer2.Interval = 300
Timer3.Interval = 300
Timer4.Interval = 300
End Sub

Private Sub Option4_Click()
Timer1.Interval = 400
Timer2.Interval = 400
Timer3.Interval = 400
Timer4.Interval = 400
End Sub



Private Sub Option6_Click()
i = 0
End Sub

Private Sub Option7_Click()
i = 1

End Sub


Private Sub Picture5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Text = X
Text2.Text = Y

End Sub

Private Sub Picture5_Paint()
Picture5.ForeColor = vbRed
Picture5.PSet (1365, 1365), vbRed
Picture5.Line (1365, 1365)-(1365, 1155)
End Sub

Private Sub Timer1_Timer()
If i = 0 Then
j = 10
k = 10
Out ("&H" + "378"), Val(2 ^ (p))
Timer2.Enabled = True
Timer1.Enabled = False
Picture1.BackColor = vbRed
Picture2.BackColor = vbDefault
Picture3.BackColor = vbDefault
Picture4.BackColor = vbDefault
Label3.Caption = "1"
Label4.Caption = "0"
Label5.Caption = "0"
Label6.Caption = "0"
Picture5.Line (1365, 1365)-(1365 + j, 1365 + j)
Else
Out ("&H" + "378"), Val(2 ^ (p + 3))
Timer2.Enabled = True
Timer1.Enabled = False
Picture4.BackColor = vbRed
Picture2.BackColor = vbDefault
Picture3.BackColor = vbDefault
Picture1.BackColor = vbDefault
Label6.Caption = "1"
Label4.Caption = "0"
Label5.Caption = "0"
Label3.Caption = "0"
End If
End Sub
Private Sub Timer2_Timer()
If i = 0 Then
Out ("&H" + "378"), Val(2 ^ (p + 1))
Timer3.Enabled = True
Timer2.Enabled = False
Picture2.BackColor = vbRed
Picture1.BackColor = vbDefault
Picture3.BackColor = vbDefault
Picture4.BackColor = vbDefault
Label3.Caption = "0"
Label4.Caption = "1"
Label5.Caption = "0"
Label6.Caption = "0"
Else
Out ("&H" + "378"), Val(2 ^ (p + 2))
Timer3.Enabled = True
Timer2.Enabled = False
Picture3.BackColor = vbRed
Picture1.BackColor = vbDefault
Picture2.BackColor = vbDefault
Picture4.BackColor = vbDefault
Label4.Caption = "0"
Label3.Caption = "1"
Label5.Caption = "0"
Label6.Caption = "0"
End If
End Sub
Private Sub Timer3_Timer()
If i = 0 Then
Out ("&H" + "378"), Val(2 ^ (p + 2))
Timer4.Enabled = True
Timer3.Enabled = False
Picture3.BackColor = vbRed
Picture2.BackColor = vbDefault
Picture1.BackColor = vbDefault
Picture4.BackColor = vbDefault
Label3.Caption = "0"
Label4.Caption = "0"
Label5.Caption = "1"
Label6.Caption = "0"
Else
Out ("&H" + "378"), Val(2 ^ (p + 1))
Timer4.Enabled = True
Timer3.Enabled = False
Picture2.BackColor = vbRed
Picture3.BackColor = vbDefault
Picture1.BackColor = vbDefault
Picture4.BackColor = vbDefault
Label3.Caption = "0"
Label5.Caption = "0"
Label4.Caption = "1"
Label6.Caption = "0"
End If
End Sub
Private Sub Timer4_Timer()
If i = 0 Then
Out ("&H" + "378"), Val(2 ^ (p + 3))
Timer1.Enabled = True
Timer4.Enabled = False
Picture4.BackColor = vbRed
Picture2.BackColor = vbDefault
Picture3.BackColor = vbDefault
Picture1.BackColor = vbDefault
Label3.Caption = "0"
Label4.Caption = "0"
Label5.Caption = "0"
Label6.Caption = "1"
Else
Out ("&H" + "378"), Val(2 ^ (p))
Timer1.Enabled = True
Timer4.Enabled = False
Picture1.BackColor = vbRed
Picture2.BackColor = vbDefault
Picture3.BackColor = vbDefault
Picture4.BackColor = vbDefault
Label3.Caption = "0"
Label4.Caption = "0"
Label6.Caption = "0"
Label5.Caption = "1"
End If
End Sub

Private Sub Timer5_Timer()
Label8.Caption = Str(Inp(Val("&H" + "378")))
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -