📄 form8.frm
字号:
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 3
Top = 6120
Width = 1695
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
Begin VB.Menu mnuBaudRate
Caption = "&System"
Begin VB.Menu mnuBaudRate_show
Caption = "Detect Reader"
End
End
End
Attribute VB_Name = "ProBuild"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'-------------------------------------------------------
'Declarations to Disable the 'X' button on the form menu
'-------------------------------------------------------
Private Const SC_CLOSE As Long = &HF060&
Private Const MF_BYCOMMAND = &H0&
Private Declare Function DeleteMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32.dll" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
'-----------------------------------------------------------------------------------------------------------------------------------
Rem SkyeTek Protocol REQUEST fields
Dim Response$
Dim flags% ' FLAGS field
Dim command% ' COMMAND field
Dim temp As String
Dim invalidF As Boolean
Dim tag_type As String
Dim secondLF As Boolean
Dim freezeF As Boolean
Dim protocolF As Boolean
Dim stxF As Boolean
Dim fwverH$
Dim fwverL$
Dim fwver$
Dim serNum$
Dim protocolv2 As Boolean
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Function GetResponse() 'gets called from form 7 also
Dim Start As Single
' wait .1 second to give the reader time to process the command before it responds
Start = Timer
Do
Loop Until (Timer - Start) > 0.2
Response$ = ""
Do While ProBuild.MSComm1.InBufferCount > 0
DoEvents
Response$ = Response$ & ProBuild.MSComm1.Input
If Right$(Response$, 2) = vbCrLf Then
ProBuild.MSComm1.InBufferCount = 0 ' clears the receive buffer
Exit Do
End If
Loop
If Not Right$(Response$, 2) = vbCrLf Then
' unknown
Response$ = ""
GetResponse = False
ElseIf Not Left$(Response$, 1) = vbLf Then
' unknown
Response$ = ""
GetResponse = False
Else
GetResponse = True
End If
End Function
Private Function IsNotHex(KeyAscii As Integer)
If KeyAscii > &H46 Then
IsNotHex = True
End If
If KeyAscii < &H30 Then
IsNotHex = True
If KeyAscii = 8 Then
IsNotHex = False
End If
End If
If KeyAscii > &H39 Then
If KeyAscii < &H41 Then
IsNotHex = True
End If
End If
End Function
Private Sub ASCII_btn_Click()
protocolF = True
Call refresh_HostCommand_box
Response_box = ""
End Sub
Private Sub Binary_btn_Click()
protocolF = False
Call refresh_HostCommand_box
Response_box = ""
End Sub
Private Sub Clear_Click()
Response_box.Text = ""
secondLF = False
End Sub
Private Function setcom() As Boolean
On Error GoTo X:
ProBuild.MSComm1.PortOpen = True
setcom = True
'End Function
X:
If ProBuild.MSComm1.PortOpen = False Then
setcom = False
End If
End Function
Private Sub COMMAND_box_Change()
refresh_COMMAND_box
End Sub
Private Sub FLAGS_box_Change()
refresh_FLAGS_box
End Sub
Private Sub Form_Load()
Dim result$
'Disble 'X' button on form menu
DeleteMenu GetSystemMenu(Me.hWnd, False), SC_CLOSE, MF_BYCOMMAND
Call mnuBaudRate_show_Click
' Set default values
flags% = 0
command% = &H14
secondLF = False
freezeF = False
NUMBER_OF_BLOCKS_box.Locked = False
protocolF = True ' ASCII mode
stxF = False
TagType.Text = TagType.List(0) ' Sets tag_type$ and forces call to refresh_HostCommand_box in TagType_Click
'Update the Flags
UpdateFlags
End Sub
Public Function detectReader()
Dim Start As Single
Dim baudrate As Integer
Dim com As Integer
Dim result$
Dim X$ ' to clear unwanted responce characters
Form1.M8detected = False 'Set Default
Form1.M1detected = False 'Set Default
Form1.M1Minidetected = False 'Set Default
Form1.H3detected = False 'Set Default
' FOLLOWING SECTION IS FOR TEST PURPOSES ONLY>>>TO BE REMOVED
'TagType.Clear
' When M3 firmware is detected we need to set the M3 Firmware Flag
' The M3 firmware flag toggle will set/unset retrictions on which functions can be used
' If fwverH$ = "00" Then
'M8detected = False
'TagType.AddItem "00 Auto-Detect"
'TagType.AddItem "81 EPC CLASS 1"
'TagType.AddItem "82 EPC CLASS 0"
'TagType.AddItem "83 EPC CLASS 0+"
'TagType.AddItem "84 ISO180006A"
'TagType.AddItem "85 ISO180006B"
'TagType.AddItem "86 EM4222"
'TagType.AddItem "87 EM4022"
'TagType.AddItem "88 UCODE"
'TagType.AddItem "89 TAGIDU"
'TagType.AddItem "8A SCS"
'Else
'M8detected = True '
'If M8detected = False Then
'TagType.AddItem "00 Auto-Detect"
'TagType.AddItem "01 ISO15693"
'TagType.AddItem "02 I稢ode SL1"
'TagType.AddItem "03 Tag-it HF"
'TagType.AddItem "04 ISO14443A"
'TagType.AddItem "05 "
'TagType.AddItem "06 PicoTag"
'TagType.AddItem "07 "
'TagType.AddItem "08 GemWave C210"
'TagType.AddItem "09 LTO CM"
'TagType.AddItem "0A Mifare UltraLight"
' End If
' END TEST SECTION
Do
For com = 1 To 16
'com$ = InputBox("Which COM port is the SkyeRead RFID reader attached to?", "Select COM Port", "")
If ProBuild.MSComm1.PortOpen = True Then
ProBuild.MSComm1.PortOpen = False
End If
ProBuild.MSComm1.CommPort = com
ProBuild.MSComm1.InputLen = 1
ProBuild.MSComm1.RThreshold = 0 ' disble OnComm
'ProBuild.MSComm1.PortOpen = True
If setcom() = True Then
ProBuild.MSComm1.InputMode = comInputModeText
For baudrate = 0 To 3
Select Case baudrate
Case 0
'9600
ProBuild.MSComm1.Settings = "9600,N,8,1"
Case 1
' 19200
ProBuild.MSComm1.Settings = "19200,N,8,1"
Case 2
' 38400
ProBuild.MSComm1.Settings = "38400,N,8,1"
Case 3
' 57600
ProBuild.MSComm1.Settings = "57600,N,8,1"
End Select
If ProBuild.MSComm1.PortOpen = True Then
ProBuild.MSComm1.Output = vbCr & "00220101" & vbCr ' request the reader firmware version
End If
Sleep 400
'Start = Timer
'Do
'Loop Until (Timer - Start) > 0.4
If GetResponse() = True Then
fwverH$ = Mid$(Response$, 4, 2)
fwverL$ = Mid$(Response$, 6, 2)
fwver$ = fwverH$
If fwverL$ = vbCrLf Then
' this must be firmware version 000D or lower so it has no serial number
fwver$ = "00" & fwverH$
serNum$ = "Not Available"
Exit Function
End If
fwver$ = fwverH$ & fwverL$
If ProBuild.MSComm1.PortOpen = True Then
ProBuild.MSComm1.Output = vbCr & "00220001" & vbCr ' get the reader serial number for fw versions > 0D
End If
If GetResponse() = True Then
serNum$ = Mid$(Response$, 4, 8)
Else
serNum$ = "Not Detected"
End If
' TO BE IMPLIMENTED WITH UHF READER ... Need to repopulate the TagType list with the correct tag types
TagType.Clear
' When M3 firmware is detected we need to set the M3 Firmware Flag
' and select the tag types to display
If fwverH$ = "E0" Then
Form1.M8detected = True
TagType.AddItem "00 Auto-Detect"
TagType.AddItem "81 EPC CLASS 1"
TagType.AddItem "82 EPC CLASS 0"
TagType.AddItem "83 EPC CLASS 0+ IMPINJ"
TagType.AddItem "84 EPC CLASS 0+ MATRICS"
TagType.AddItem "85 ISO180006A"
TagType.AddItem "86 ISO180006B"
TagType.AddItem "87 EPC CLASS 1 Gen 2"
TagType.AddItem "88 EM4222"
TagType.AddItem "89 EM4022"
TagType.AddItem "8A UCODE"
TagType.AddItem "8B TAGIDU"
TagType.AddItem "8C SCS"
Else
Form1.M8detected = False
TagType.AddItem "00 Auto-Detect"
TagType.AddItem "01 ISO15693"
TagType.AddItem "02 I稢ode SL1"
TagType.AddItem "03 Tag-it HF"
TagType.AddItem "04 ISO14443A"
TagType.AddItem "05 "
TagType.AddItem "06 PicoTag"
TagType.AddItem "07 "
TagType.AddItem "08 GemWave C210"
TagType.AddItem "09 LTO CM"
TagType.AddItem "0A Mifare UltraLight"
End If
Exit Function
End If
Next ' baud rate loop
End If
If ProBuild.MSComm1.PortOpen = True Then
ProBuild.MSComm1.PortOpen = False
End If
Next ' try the next com port
result = MsgBox("No SkyeRead Device Detected ", vbAbortRetryIgnore, "SkyeRead Device")
Loop Until ((result = vbAbort) Or (result = vbIgnore))
If (result = vbAbort) Then
End
End If
End Function
Private Sub mnuBaudRate_show_Click()
Dim result
Dim a$
Call detectReader
ProBuild.MSComm1.RThreshold = 1 ' Enable OnComm again
If ProBuild.MSComm1.PortOpen = True Then
result = MsgBox("SkyeWare Version = 03.02.00" & vbCrLf & vbCrLf & "Com Port = " & MSComm1.CommPort & vbCrLf & "Baud Rate = " & ProBuild.MSComm1.Settings & vbCrLf & "Firmware Version = " & fwver$ & vbCrLf & "Serial Number = " & serNum$, vbOKOnly, "SkyeRead Device Information")
' result = MsgBox("Baud Rate = " & ProBuild.MSComm1.Settings & vbCrLf & "Firmware Version = " & fwver$ & vbCrLf & "Serial Number = " & serNum$, vbOKOnly, "SkyeRead Device Information")
Else
result = MsgBox("No Reader Detected", vbOKOnly, "SkyeRead Device Information")
End If
If fwver$ > "001A" Then
protocolv2 = True
Else
protocolv2 = False
End If
End Sub
Private Sub MSComm1_OnComm()
Dim rx$
Dim H$
Dim X As Integer
Dim p As String
Dim Start As Single
If protocolF = True Then
If ProBuild.MSComm1.InBufferCount Then
rx$ = ProBuild.MSComm1.Input
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -