?? form1.frm
字號(hào):
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5130
ClientLeft = 2850
ClientTop = 4455
ClientWidth = 8430
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "Form1.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5130
ScaleWidth = 8430
Begin VB.ComboBox cobCardNO
Height = 345
Left = 1470
Style = 2 'Dropdown List
TabIndex = 7
Top = 270
Width = 2130
End
Begin VB.Timer Timer1
Interval = 100
Left = 6495
Top = 975
End
Begin VB.CommandButton Command4
Caption = "輸出010101..."
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 975
TabIndex = 3
Top = 4140
Width = 2955
End
Begin VB.CommandButton Command5
Caption = "輸出101010..."
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4395
TabIndex = 2
Top = 4155
Width = 2955
End
Begin VB.CommandButton Command6
Caption = "開(kāi)關(guān)量輸入,十六進(jìn)制顯示"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4395
TabIndex = 1
Top = 3345
Width = 2955
End
Begin VB.CommandButton Command7
Caption = "開(kāi)關(guān)量輸入,二進(jìn)制顯示"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 975
TabIndex = 0
Top = 3345
Width = 2955
End
Begin VB.Label lblBaseAddr
BorderStyle = 1 'Fixed Single
Caption = "板卡基地址"
Height = 360
Left = 5235
TabIndex = 10
Top = 315
Width = 1800
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "板卡基地址:"
Height = 225
Left = 3870
TabIndex = 9
Top = 375
Width = 1245
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "選擇板卡:"
Height = 225
Left = 315
TabIndex = 8
Top = 345
Width = 1020
End
Begin VB.Label lbl_Err
Caption = "錯(cuò)誤號(hào):"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 750
TabIndex = 6
Top = 1095
Width = 3255
End
Begin VB.Label Label3
Caption = "Label3"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 750
TabIndex = 5
Top = 1845
Width = 6810
End
Begin VB.Label Label5
Caption = "Label5"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 750
TabIndex = 4
Top = 2505
Width = 6825
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cobCardNO_Click()
'選擇板卡
m_cardNO = cobCardNO.ListIndex + ZT8408_GetBaseNO
'MsgBox ZT8408_GetDllRefCount
'Exit Sub
If ZT8408_OpenDevice(m_cardNO) <> 0 Then
MsgBox "打開(kāi)設(shè)備失敗,找不到指定的板卡。"
Exit Sub
End If
lblBaseAddr.Caption = Hex(ZT8408_GetBaseAddr(m_cardNO))
End Sub
Private Sub Command4_Click()
'開(kāi)關(guān)量輸出,輸出010101...
ZT8408_DOAll m_cardNO, &H5555 '從16到1
' ZT8408_DOAll m_cardNO, &HFFFF '從16到1
lbl_Err.Caption = "錯(cuò)誤號(hào):" & ZT8408_GetLastErr '返回函數(shù)執(zhí)行的狀態(tài)
End Sub
Private Sub Command5_Click()
'開(kāi)關(guān)量輸出,輸出101010...
ZT8408_DOAll m_cardNO, &HAAAA '從16到1
' ZT8408DOAll m_cardNO, &HFFFFFFFF '從32到1
lbl_Err.Caption = "錯(cuò)誤號(hào):" & ZT8408_GetLastErr '返回函數(shù)執(zhí)行的狀態(tài)
End Sub
Private Sub Command6_Click()
'所有通道開(kāi)關(guān)量輸入,從16到1,十六進(jìn)制顯示
Label5.Caption = "DI數(shù)據(jù)十六進(jìn)制顯示:" & Hex(ZT8408_DIAll(m_cardNO))
lbl_Err.Caption = "錯(cuò)誤號(hào):" & ZT8408_GetLastErr '返回函數(shù)執(zhí)行的狀態(tài)
End Sub
Private Sub Command7_Click()
'所有通道開(kāi)關(guān)量輸入,從16到1,二進(jìn)制顯示
Dim outStr As String
outStr = ""
For i = 15 To 0 Step -1
'outStr = ZT8408DIBit(m_m_cardNO, i + 1) & " " & outStr
outStr = outStr & "" & ZT8408_DIBit(m_cardNO, i + 1)
If i Mod 4 = 0 Then outStr = outStr & " , "
'If (i + 1) Mod 4 = 0 Then outStr = " , " & outStr
Next i
outStr = IIf(Right(outStr, 3) = " , ", Left(outStr, Len(outStr) - 3), outStr)
Label3.Caption = "DI數(shù)據(jù) 二進(jìn)制 顯示:" & outStr
lbl_Err.Caption = "錯(cuò)誤號(hào):" & ZT8408_GetLastErr '返回函數(shù)執(zhí)行的狀態(tài)
End Sub
Private Sub Form_Load()
'打開(kāi)設(shè)備
If ZT8408_GetCardCount() <= 0 Then
MsgBox "打開(kāi)設(shè)備失敗,找不到此類(lèi)板卡。" & vbCrLf & _
"可能是未插卡或未安裝驅(qū)動(dòng)"
'使所有控件失效
' For Each ctl In Me.Controls
' ctl.Enabled = False
' Next ctl
' Exit Sub
End
End If
Me.Caption = "系統(tǒng)中已識(shí)別的此類(lèi)板卡的數(shù)量為:" & ZT8408_GetCardCount & " 塊"
For i = 0 To ZT8408_GetCardCount - 1
cobCardNO.AddItem "第 " & i + 1 & " 塊卡"
Next i
If ZT8408_GetCardCount > 0 Then cobCardNO.ListIndex = 0
Timer1.Enabled = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
'關(guān)閉設(shè)備
If ZT8408_CloseDevice(m_cardNO) <> 0 Then
'MsgBox "關(guān)閉設(shè)備失敗"
End If
End Sub
Private Sub Timer1_Timer()
Command7_Click
Command6_Click
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -