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

📄 ac1057.frm

📁 车辆二级维护竣工检测检验线部分源程序代码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Index           =   9
         Left            =   2520
         TabIndex        =   46
         Top             =   960
         Width           =   915
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         Caption         =   "0.0000"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Index           =   7
         Left            =   240
         TabIndex        =   26
         Top             =   960
         Width           =   915
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         Caption         =   "0.0000"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Index           =   6
         Left            =   7200
         TabIndex        =   25
         Top             =   360
         Width           =   915
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         Caption         =   "0.0000"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Index           =   5
         Left            =   6000
         TabIndex        =   24
         Top             =   360
         Width           =   915
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         Caption         =   "0.0000"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Index           =   4
         Left            =   4800
         TabIndex        =   23
         Top             =   360
         Width           =   915
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         Caption         =   "0.0000"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Index           =   3
         Left            =   3600
         TabIndex        =   22
         Top             =   360
         Width           =   915
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         Caption         =   "0.0000"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Index           =   2
         Left            =   2520
         TabIndex        =   21
         Top             =   360
         Width           =   915
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         Caption         =   "0.0000"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Index           =   1
         Left            =   1440
         TabIndex        =   20
         Top             =   360
         Width           =   915
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         Caption         =   "0.0000"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Index           =   0
         Left            =   240
         TabIndex        =   19
         Top             =   360
         Width           =   915
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "AIn"
      Height          =   975
      Index           =   0
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   7665
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   11
         Left            =   6960
         Shape           =   3  'Circle
         Top             =   375
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   10
         Left            =   6345
         Shape           =   3  'Circle
         Top             =   375
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   9
         Left            =   5730
         Shape           =   3  'Circle
         Top             =   375
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   8
         Left            =   5145
         Shape           =   3  'Circle
         Top             =   375
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   7
         Left            =   4560
         Shape           =   3  'Circle
         Top             =   360
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   6
         Left            =   3942
         Shape           =   3  'Circle
         Top             =   360
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   5
         Left            =   3325
         Shape           =   3  'Circle
         Top             =   360
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   4
         Left            =   2708
         Shape           =   3  'Circle
         Top             =   360
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   3
         Left            =   2091
         Shape           =   3  'Circle
         Top             =   360
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   2
         Left            =   1474
         Shape           =   3  'Circle
         Top             =   360
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   1
         Left            =   857
         Shape           =   3  'Circle
         Top             =   360
         Width           =   255
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H0000FF00&
         Height          =   255
         Index           =   0
         Left            =   240
         Shape           =   3  'Circle
         Top             =   360
         Width           =   255
      End
   End
   Begin VB.Label Label3 
      Caption         =   "pc的低四位输入"
      Height          =   375
      Left            =   3240
      TabIndex        =   45
      Top             =   4800
      Width           =   1575
   End
   Begin VB.Label Label2 
      Caption         =   "pa的8位输入"
      Height          =   255
      Left            =   720
      TabIndex        =   44
      Top             =   4680
      Width           =   1215
   End
End
Attribute VB_Name = "AC1957"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Combo1_click()
On Error Resume Next
W = WritePrivateProfileString("COM", "COM", Combo1.Text, App.Path & "\com.ini")
CommLED.PortOpen = False
CommLED.InputMode = comInputModeBinary
CommLED.CommPort = Int(Combo1.Text)
CommLED.Settings = "9600,N,8,1"
CommLED.PortOpen = True
End Sub

Private Sub Command1_Click(Index As Integer)

Dim a As Integer
If Index < 8 Then
 AC1057IOOutData = AC1057IOOutData Or (2 ^ Index)
 AC1057_OutputIOData_VB NTportio, BaseAC1057, 1, AC1057IOOutData
Else
 a = Index - 4 '低四位所以-4
 AC1057IOOutHData = AC1057IOOutHData Or (2 ^ a)
 AC1057_OutputIOData_VB NTportio, BaseAC1057, 2, AC1057IOOutHData
End If

End Sub

Private Sub Command2_Click(Index As Integer)
Dim a As Integer
If Index < 8 Then
 AC1057IOOutData = AC1057IOOutData And (255 - 2 ^ Index)
 AC1057_OutputIOData_VB NTportio, BaseAC1057, 1, AC1057IOOutData
Else
 a = Index - 4
 AC1057IOOutHData = AC1057IOOutHData And (255 - 2 ^ a)
 AC1057_OutputIOData_VB NTportio, BaseAC1057, 2, AC1057IOOutHData
End If
End Sub

Private Sub Command3_Click()
If CommLED.PortOpen = True Then CommLED.PortOpen = False
Me.Enabled = False
Unload Me
End
End Sub

Private Sub Command4_Click()
Command4.Enabled = True
If Trim(LED(0).Text) <> "" Then
    Call SendLed(Trim(LED(0).Text), 1)
End If
Call Delay(0.2)
If Trim(LED(1).Text) <> "" Then
    Command4.Enabled = False
    Call SendLed(Trim(LED(1).Text), 2)
    Call Delay(2)
End If
Command4.Enabled = True
End Sub

Private Sub Form_Load()
Dim dbName As String
Dim strPrv As String

Dim i As Integer
NTportio = AC_OpenDriver_VB() '加载驱动,获得驱动句柄
BaseAC1057 = &H240 '基地址h240,读A/D状态State
AC1057IOOutData = 0 '初始化
'AC1057IOOutHData = 0 '初始化
'AC1057IOOutData = True
AC1057_SetIOState_VB NTportio, BaseAC1057, &H91 '输入\输出的设定
'For i = 0 To 2
AC1057_OutputIOData_VB NTportio, BaseAC1057, 1, AC1057IOOutData '表示PB的输出
AC1057_OutputIOData_VB NTportio, BaseAC1057, 2, AC1057IOOutHData '表示PC的高四位输出
'Next i




'屏
R = String(4, Chr(0))
COM = Left(R, GetPrivateProfileString("COM", "COM", "", R, Len(R), App.Path & "\com.ini"))
Combo1.Text = COM
CommLED.InputMode = comInputModeBinary
CommLED.CommPort = Int(COM)
CommLED.Settings = "9600,N,8,1"
If Not CommLED.PortOpen Then
    CommLED.PortOpen = True
Else
    CommLED.PortOpen = False
    CommLED.PortOpen = True
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
AC_CloseDriver_VB NTportio '卸载驱动
End Sub


Private Sub Timer1_Timer()
Dim AIn As Integer, CIn As Integer, i As Integer
Dim tt As Long, ttt As Single

AIn = AC1057_InputIOData_VB(NTportio, BaseAC1057, 0) '表示PA的输入
CIn = AC1057_InputIOData_VB(NTportio, BaseAC1057, 2) '表示PC的输入
For i = 0 To 11
   If i < 8 Then
            If (AIn And (2 ^ i)) = 0 Then
               Shape1(i).BackStyle = 1
            Else
               Shape1(i).BackStyle = 0
            End If
            
            '数据
            tt = AC1057_ADSampleAverage_VB(NTportio, BaseAC1057, i, 100)
             ' -5 - +5V voltage
            Label1(i).Caption = Round((tt - 2048) * 5 / 2048, 3)
   Else
            If (CIn And (2 ^ (i - 8))) = 0 Then
              Shape1(i).BackStyle = 1
            Else
              Shape1(i).BackStyle = 0
            End If
             
            tt = AC1057_ADSampleAverage_VB(NTportio, BaseAC1057, i, 100)
             ' -5 - +5V voltage
            Label1(i).Caption = Round((tt - 2048) * 5 / 2048, 3)
   End If
    'If i = 0 Then Text1 = tt
    ' 0 - 10V voltage
    'Label1(i).Caption = Int(tt * 10 / 4095 * 1000) / 1000
    'ttt = Round((tt - 2048) * 5 / 2048, 3)
    'Label1(i).Caption = ttt
Next i
Text1 = AIn
Text2 = CIn
End Sub

⌨️ 快捷键说明

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