?? mdlglbvar.bas
字號:
Attribute VB_Name = "MdlGlbVar"
Option Explicit
'define Global Type
Type Type_Decode
strCode As String '用戶編寫的代碼
strMachineCode As String * 13
blNeedPara As Boolean
fPara As Single
fParaLower As Single
fParaUpper As Single
End Type
'define Global const
Public strStepCode As String
'Public Const strStepCode = "0xFF"
Public Const strTipChar = "?"
'Global Variebls
Public strFileName As String
Public DecodeMap(1 To 13) As Type_Decode
Public CurCommand As String '當前命令
Public Cmd As String
Public Code1 As String
Public Code2 As String
Public Code3 As String
Public Code4 As String
Public Code5 As String
Public Code6 As String
Public Code7 As String
Public Code8 As String
Public Code9 As String
Public Code10 As String
Public Code11 As String
Public Code12 As String
Public Code13 As String
Public nCmdIndex As Integer
Public nCmdPara As Integer
Public nDelayTime As Integer
Public nCodeIndex As Integer
Public blSingleStep As Boolean
'Global Functions
Public Sub InitialCodeMap()
'/////////give intial value for DecodeMap//////////
'strStepCode = Code13
With DecodeMap(1)
.strCode = "正轉" 'set positive velocity
'.strMachineCode = "0x11"
.strMachineCode = Code1
.blNeedPara = True
.fPara = 0
.fParaLower = 0
.fParaUpper = 255
End With
With DecodeMap(2)
.strCode = "反轉" 'set negative velocity
'.strMachineCode = "0x22"
.strMachineCode = Code2
.blNeedPara = True
.fPara = 0
.fParaLower = 0
.fParaUpper = 255
End With
With DecodeMap(3)
.strCode = "查詢電壓" '查詢電壓
'.strMachineCode = "0x33"
.strMachineCode = Code8
.blNeedPara = False
.fPara = 0
.fParaLower = 0
.fParaUpper = 255
End With
With DecodeMap(4)
.strCode = "查詢電流" '查詢電流
'.strMachineCode = "0x44"
.strMachineCode = Code9
.blNeedPara = False
.fPara = 0
.fParaLower = 0
.fParaUpper = 0
End With
With DecodeMap(5)
.strCode = "查詢轉矩" 'require sensor詢問轉矩
'strMachineCode = "0x55"
.strMachineCode = Code10
.blNeedPara = False
.fPara = 0
.fParaLower = 0
.fParaUpper = 0
End With
With DecodeMap(6)
.strCode = "停機" 'shut down power
'.strMachineCode = "0x66"
.strMachineCode = Code3
.blNeedPara = False
.fPara = 0
.fParaLower = 0
.fParaUpper = 0
End With
With DecodeMap(7)
.strCode = "開始轉矩傳感" '開始轉矩傳感
'.strMachineCode = "0x77"
.strMachineCode = Code12
.blNeedPara = False
.fPara = 0
.fParaLower = 0
.fParaUpper = 0
End With
With DecodeMap(8)
.strCode = "設定定子電阻" '修改定子電阻
'.strMachineCode = "0x88"
.strMachineCode = Code4
.blNeedPara = True
.fPara = 0
.fParaLower = 0
.fParaUpper = 255
End With
With DecodeMap(9)
.strCode = "設定轉子電阻" '修改轉子電阻
'.strMachineCode = "0x99"
.strMachineCode = Code5
.blNeedPara = True
.fPara = 0
.fParaLower = 0
.fParaUpper = 255
End With
With DecodeMap(10)
.strCode = "接收命令正確" '接受命令正確
.strMachineCode = "0xaa"
.blNeedPara = False
.fPara = 0
.fParaLower = 0
.fParaUpper = 255
End With
With DecodeMap(11)
.strCode = "SETBYTE" '調試時用于發送單個字節
.strMachineCode = "0xBB"
.blNeedPara = True
.fPara = 0
.fParaLower = 0
.fParaUpper = 255
End With
With DecodeMap(12)
.strCode = "設定定子電感"
'.strMachineCode = "0xCC"
.strMachineCode = Code6
.blNeedPara = True
.fPara = 0
.fParaLower = 0
.fParaUpper = 255
End With
With DecodeMap(13)
.strCode = "設定轉子電感"
'.strMachineCode = "0xDD"
.strMachineCode = Code7
.blNeedPara = True
.fPara = 0
.fParaLower = 0
.fParaUpper = 255
End With
'//////////////////////////////////////////////////////////////////
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -