?? dlgextern.frm
字號:
VERSION 5.00
Begin VB.Form DLGEXTERN
Caption = "擴(kuò)展命令"
ClientHeight = 5175
ClientLeft = 60
ClientTop = 450
ClientWidth = 7785
LinkTopic = "Form1"
ScaleHeight = 5175
ScaleWidth = 7785
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Recieve
Caption = "接收"
Height = 375
Left = 4980
TabIndex = 8
Top = 3720
Width = 1065
End
Begin VB.CommandButton OnButtonSend
Caption = "發(fā)送"
Height = 375
Left = 3900
TabIndex = 7
Top = 3720
Width = 1065
End
Begin VB.TextBox IBuff
Height = 1725
Left = 360
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 6
Text = "DLGEXTERN.frx":0000
Top = 1710
Width = 6855
End
Begin VB.TextBox Para4
Height = 375
Left = 6210
TabIndex = 5
Text = "Text6"
Top = 1170
Width = 975
End
Begin VB.TextBox Para3
Height = 375
Left = 4460
TabIndex = 4
Text = "Text5"
Top = 1170
Width = 975
End
Begin VB.TextBox Para2
Height = 375
Left = 2715
TabIndex = 3
Text = "Text4"
Top = 1170
Width = 975
End
Begin VB.TextBox Para1
Height = 375
Left = 970
TabIndex = 2
Text = "Text3"
Top = 1170
Width = 975
End
Begin VB.TextBox ILeng
Height = 375
Left = 6210
TabIndex = 1
Text = "Text2"
Top = 690
Width = 975
End
Begin VB.TextBox ICmdcode
Height = 375
Left = 2715
TabIndex = 0
Text = "Text1"
Top = 690
Width = 975
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "參數(shù)4"
Height = 180
Left = 5595
TabIndex = 14
Top = 1260
Width = 450
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "參數(shù)3"
Height = 180
Left = 3850
TabIndex = 13
Top = 1260
Width = 450
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "參數(shù)2"
Height = 180
Left = 2105
TabIndex = 12
Top = 1260
Width = 450
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "參數(shù)1"
Height = 180
Left = 360
TabIndex = 11
Top = 1260
Width = 450
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "長度(<=38H)"
Height = 180
Left = 5070
TabIndex = 10
Top = 750
Width = 990
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "輸入命令碼 / 輸出狀態(tài)碼"
Height = 180
Left = 360
TabIndex = 9
Top = 750
Width = 2070
End
End
Attribute VB_Name = "DLGEXTERN"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
'CXRAMPage m_xram;
Dim Buffer(MAX_DATA_SIZE * 2) As Byte
Dim Leng As Long
Dim tems As String
If (CH375DBG_Opened = False) Then
MsgBox "設(shè)備未打開", vbOKCancel, "CH37XDBG"
Exit Sub
End If
' 寫出命令塊
Leng = Len(USB_UP_PKT)
If (CH375ReadData(CH375DBG_Index, Up, Leng) = True) Then
' 讀取應(yīng)答塊
If (Up.mCommandNot = Down.mCommandNot) Then ' 操作成功
'狀態(tài)碼
m_Comm = Hex(Up.mStatus)
'返回碼1
Text3.Text = hex2bit(Up.mReserved(0))
'返回碼2
Text4.Text = hex2bit(Up.mReserved(1))
'返回碼3
Text5.Text = hex2bit(Up.mReserved(2))
'返回碼4
Text6.Text = hex2bit(Up.mReserved(3))
'返回長度
m_Len = hex2bit(Up.mLength)
tems = ""
For i = 0 To Up.mLength - 1
tems = hex2bit(Up.mBuffer(i)) ' 返回數(shù)據(jù)
Next i
Text7.Text = tems
Else
MsgBox "返回狀態(tài)錯誤!", vbOKCancel, "CH37XDBG"
Exit Sub
End If
Else
MsgBox "讀失敗!", vbOKCancel, "CH37XDBG"
End If
End Sub
Private Sub OnButtonSend_Click()
Dim m_Comm As String
Dim m_Len As String
Dim m_Para1 As String
Dim m_Para2 As String
Dim m_Para3 As String
Dim m_Para4 As String
Dim m_Buff As String
Dim tems As String
Dim Buffer(120) As Byte
Dim Length As Byte
Dim temh As Byte
Dim Leng As Long
m_Comm = Trim(Text1.Text)
m_Len = Trim(Text2.Text)
m_Para1 = Trim(Text3.Text)
m_Para2 = Trim(Text4.Text)
m_Para3 = Trim(Text5.Text)
m_Para4 = Trim(Text6.Text)
m_Buff = Trim(Text7.Text)
If (CH375DBG_Opened = False) Then
MsgBox "設(shè)備未打開", vbOKCancel, "CH37XDBG"
Exit Sub
End If
'命令碼
If (Len(m_Comm) > 0) Then
Down.mCommand = hextobcd(m_Comm)
Else
Down.mCommand = 0
End If
'反命令碼
Down.mCommandNot = Not Down.mCommand
'參數(shù)1
If (Len(m_Para1) > 0) Then
Down.u.mByte(0) = hextobcd(m_Para1)
Else
Down.u.mByte(0) = 0
End If
'參數(shù)2
If (Len(m_Para2) > 0) Then
Down.u.mByte(1) = hextobcd(m_Para2)
Else
Down.u.mByte(1) = 0
End If
'參數(shù)3
If (Len(m_Para3) > 0) Then
Down.u.mByte(2) = hextobcd(m_Para3)
Else
Down.u.mByte(3) = 0
End If
'參數(shù)4
If (Len(m_Para4) > 0) Then
Down.u.mByte(4) = hextobcd(m_Para4)
Else
Down.u.mByte(4) = 0
End If
'長度
If (Len(m_Len) > 0) Then
Down.mLength = hextobcd(m_Len)
Else
Length = 0
End If
If (m_buf <> "") Then
For i = 0 To Down.mLength - 1
tems = Trim(Mid(m_buf, (i * 2 + 1), 2))
If tems = "" Then
temh = 0
Else
temh = hextobcd(tems)
End If
Down.mBuffer(i) = temh
Next i
End If
'len = mOFFSET( USB_DOWN_PKT, mBuffer ) + down.mLength
Leng = Len(USB_DOWN_PKT) + Down.mLength
'發(fā)送數(shù)據(jù)
If (CH375Writedata(CH375DBG_Index, Down, Leng) = False) Then
MsgBox "發(fā)送失敗", vbOKCancel, "CH37XDBG"
Exit Sub
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
Text7.SelLength = 1
If KeyAscii > 96 And KeyAscii < 123 Then
KeyAscii = KeyAscii - 32 '字母小寫轉(zhuǎn)成大寫
End If
If KeyAscii > 70 And KeyAscii < 91 Or (KeyAscii >= 0 And KeyAscii <= 7) Or (KeyAscii >= 11 And KeyAscii <= 12) _
Or (KeyAscii >= 14 And KeyAscii <= 47) Or (KeyAscii >= 58 And KeyAscii <= 64) Or (KeyAscii >= 91 And KeyAscii <= 96) _
Or (KeyAscii >= 123 And KeyAscii <= 127) Then '非有效進(jìn)制值為0
KeyAscii = 48
End If
If KeyAscii <> 8 And KeyAscii <> 13 Then
Text7.SelText = Chr(KeyAscii) '將輸入的字符顯示出來
KeyAscii = 0 '屏蔽系統(tǒng)顯示前面 Text4.SelText = Chr(KeyAscii)已經(jīng)顯示出來
End If
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -