📄 publicfun_module.bas
字号:
CRCListLo(167) = &HBA
CRCListLo(168) = &HBE
CRCListLo(169) = &H7E
CRCListLo(170) = &H7F
CRCListLo(171) = &HBF
CRCListLo(172) = &H7D
CRCListLo(173) = &HBD
CRCListLo(174) = &HBC
CRCListLo(175) = &H7C
CRCListLo(176) = &HB4
CRCListLo(177) = &H74
CRCListLo(178) = &H75
CRCListLo(179) = &HB5
CRCListLo(180) = &H77
CRCListLo(181) = &HB7
CRCListLo(182) = &HB6
CRCListLo(183) = &H76
CRCListLo(184) = &H72
CRCListLo(185) = &HB2
CRCListLo(186) = &HB3
CRCListLo(187) = &H73
CRCListLo(188) = &HB1
CRCListLo(189) = &H71
CRCListLo(190) = &H70
CRCListLo(191) = &HB0
CRCListLo(192) = &H50
CRCListLo(193) = &H90
CRCListLo(194) = &H91
CRCListLo(195) = &H51
CRCListLo(196) = &H93
CRCListLo(197) = &H53
CRCListLo(198) = &H52
CRCListLo(199) = &H92
CRCListLo(200) = &H96
CRCListLo(201) = &H56
CRCListLo(202) = &H57
CRCListLo(203) = &H97
CRCListLo(204) = &H55
CRCListLo(205) = &H95
CRCListLo(206) = &H94
CRCListLo(207) = &H54
CRCListLo(208) = &H9C
CRCListLo(209) = &H5C
CRCListLo(210) = &H5D
CRCListLo(211) = &H9D
CRCListLo(212) = &H5F
CRCListLo(213) = &H9F
CRCListLo(214) = &H9E
CRCListLo(215) = &H5E
CRCListLo(216) = &H5A
CRCListLo(217) = &H9A
CRCListLo(218) = &H9B
CRCListLo(219) = &H5B
CRCListLo(220) = &H99
CRCListLo(221) = &H59
CRCListLo(222) = &H58
CRCListLo(223) = &H98
CRCListLo(224) = &H88
CRCListLo(225) = &H48
CRCListLo(226) = &H49
CRCListLo(227) = &H89
CRCListLo(228) = &H4B
CRCListLo(229) = &H8B
CRCListLo(230) = &H8A
CRCListLo(231) = &H4A
CRCListLo(232) = &H4E
CRCListLo(233) = &H8E
CRCListLo(234) = &H8F
CRCListLo(235) = &H4F
CRCListLo(236) = &H8D
CRCListLo(237) = &H4D
CRCListLo(238) = &H4C
CRCListLo(239) = &H8C
CRCListLo(240) = &H44
CRCListLo(241) = &H84
CRCListLo(242) = &H85
CRCListLo(243) = &H45
CRCListLo(244) = &H87
CRCListLo(245) = &H47
CRCListLo(246) = &H46
CRCListLo(247) = &H86
CRCListLo(248) = &H82
CRCListLo(249) = &H42
CRCListLo(250) = &H43
CRCListLo(251) = &H83
CRCListLo(252) = &H41
CRCListLo(253) = &H81
CRCListLo(254) = &H80
CRCListLo(255) = &H40
End Sub
Public Function Addr_Handle(stext As String) As Boolean
If IsNumeric(Val(stext)) And Len(stext) < 4 Then
If Val(stext) < 1 Or Val(stext) > 255 Or Val(stext) <> CInt(Val(stext)) Then
Addr_Handle = False
MsgBox LoadResString(159), , LoadResString(124)
Exit Function
Else
ParaAddr_W = Val(stext)
Addr_Handle = True
End If
Else
Addr_Handle = False
MsgBox LoadResString(159), , LoadResString(124)
Exit Function
End If
End Function
Public Function CT_Handle(stext As String) As Boolean
If IsNumeric(Val(stext)) And Len(stext) < 7 Then
If Val(stext) < 0.1 Or Val(stext) > 6500 Or Val(stext) * 10 <> CLng(Val(stext) * 10) Then
CT_Handle = False
MsgBox LoadResString(154), , LoadResString(124)
Exit Function
Else
ParaCt_W = CLng(Val(stext) * 10)
CT_Handle = True
End If
Else
CT_Handle = False
MsgBox LoadResString(154), , LoadResString(124)
Exit Function
End If
End Function
Public Function PT_Handle(stext As String) As Boolean
If IsNumeric(Val(stext)) And Len(stext) < 7 Then
If Val(stext) < 0.1 Or Val(stext) > 6500 Or Val(stext) * 10 <> CLng(Val(stext) * 10) Then
PT_Handle = False
MsgBox LoadResString(155), , LoadResString(124)
Exit Function
Else
ParaPt_W = CLng(Val(stext) * 10)
PT_Handle = True
End If
Else
PT_Handle = False
MsgBox LoadResString(155), , LoadResString(124)
Exit Function
End If
End Function
Public Function Back_Handle(stext As String) As Boolean
If HardwareType = 6 Then
If IsNumeric(Val(stext)) And Len(stext) < 5 Then
If Val(stext) < 0.01 Or Val(stext) > 2.55 Or Val(stext) * 100 <> CLng(Val(stext) * 100) Then
Back_Handle = False
MsgBox LoadResString(156), , LoadResString(124)
Exit Function
Else
ParaBack_W = CLng(Val(stext) * 1000)
Back_Handle = True
End If
Else
Back_Handle = False
MsgBox LoadResString(156), , LoadResString(124)
Exit Function
End If
ElseIf HardwareType = 1 Or HardwareType = 5 Then
If IsNumeric(Val(stext)) And Len(stext) < 6 Then
If Val(stext) < 0.001 Or Val(stext) > 0.255 Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
Back_Handle = False
MsgBox LoadResString(157), , LoadResString(124)
Exit Function
Else
ParaBack_W = CLng(Val(stext) * 1000)
Back_Handle = True
End If
Else
Back_Handle = False
MsgBox LoadResString(157), , LoadResString(124)
Exit Function
End If
Else
If IsNumeric(Val(stext)) And Len(stext) < 5 Then
If Val(stext) < 0.1 Or Val(stext) > 25.5 Or Val(stext) * 10 <> CLng(Val(stext) * 10) Then
Back_Handle = False
MsgBox LoadResString(158), , LoadResString(124)
Exit Function
Else
ParaBack_W = CLng(Val(stext) * 1000)
Back_Handle = True
End If
Else
Back_Handle = False
MsgBox LoadResString(158), , LoadResString(124)
Exit Function
End If
End If
End Function
Public Function High_Handle(stext As String) As Boolean
Dim pos As Byte
If HardwareType = 6 Or HardwareType = 7 Then
If IsNumeric(Val(stext)) Then
If Val(stext) > Val(ParaFull) + Val(SubScript) Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaHigh_W = Val(stext)
ParaHighE_W = 0
Else
ParaHigh_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaHighE_W = -(Len(stext) - pos)
End If
High_Handle = True
End If
Else
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
End If
ElseIf HardwareType = 5 Then
If IsNumeric(Val(stext)) Then
If Val(stext) > Val(ParaFull) Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaHigh_W = Val(stext)
ParaHighE_W = 0
Else
ParaHigh_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaHighE_W = -(Len(stext) - pos)
End If
High_Handle = True
End If
Else
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
End If
ElseIf HardwareType = 3 Then
If IsNumeric(Val(stext)) Then
If Val(stext) > Val(ParaFull) * 1.2 Or Val(stext) < -Val(ParaFull) * 1.2 Or Val(stext) < 0 Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaHigh_W = Val(stext)
ParaHighE_W = 0
Else
ParaHigh_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaHighE_W = -(Len(stext) - pos)
End If
High_Handle = True
End If
Else
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
End If
ElseIf HardwareType = 2 Then
If IsNumeric(Val(stext)) Then
If Val(stext) > Val(ParaFull) * 1.2 Or Val(stext) < 0 Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaHigh_W = Val(stext)
ParaHighE_W = 0
Else
ParaHigh_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaHighE_W = -(Len(stext) - pos)
End If
High_Handle = True
End If
Else
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
End If
ElseIf HardwareType = 0 Or HardwareType = 8 Then
If IsNumeric(Val(stext)) Then
If Val(stext) > Val(ParaFull) * 1.2 * Val(ParaPt) Or Val(stext) < 0 Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaHigh_W = Val(stext)
ParaHighE_W = 0
Else
ParaHigh_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaHighE_W = -(Len(stext) - pos)
End If
High_Handle = True
End If
Else
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
End If
ElseIf HardwareType = 4 Then
If IsNumeric(Val(stext)) Then
If Val(stext) > Val(ParaFull) * 1.2 * Val(ParaPt) * Val(ParaCt) Or Val(stext) < 0 Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaHigh_W = Val(stext)
ParaHighE_W = 0
Else
ParaHigh_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaHighE_W = -(Len(stext) - pos)
End If
High_Handle = True
End If
Else
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
End If
ElseIf HardwareType = 1 Or HardwareType = 9 Or HardwareType = 10 Or HardwareType = 11 Or HardwareType = 12 Then
If IsNumeric(Val(stext)) Then
If Val(stext) > Val(ParaFull) * 1.2 * Val(ParaCt) Or Val(stext) < 0 Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaHigh_W = Val(stext)
ParaHighE_W = 0
Else
ParaHigh_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaHighE_W = -(Len(stext) - pos)
End If
High_Handle = True
End If
Else
High_Handle = False
MsgBox LoadResString(160), , LoadResString(124)
Exit Function
End If
End If
End Function
Public Function Low_Handle(stext As String) As Boolean
Dim pos As Byte
If HardwareType = 6 Or HardwareType = 7 Then
If IsNumeric(Val(stext)) Then
If Val(stext) > Val(ParaFull) + Val(SubScript) Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
Low_Handle = False
MsgBox LoadResString(161), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaLow_W = Val(stext)
ParaLowE_W = 0
Else
ParaLow_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaLowE_W = -(Len(stext) - pos)
End If
Low_Handle = True
End If
Else
Low_Handle = False
MsgBox LoadResString(161), , LoadResString(124)
Exit Function
End If
ElseIf HardwareType = 3 Then
If IsNumeric(Val(stext)) Then
If Val(stext) < -Val(ParaFull) * 1.2 Or Val(stext) > Val(ParaFull) * 1.2 Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
Low_Handle = False
MsgBox LoadResString(161), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaLow_W = Val(stext)
ParaLowE_W = 0
Else
ParaLow_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaLowE_W = -(Len(stext) - pos)
End If
Low_Handle = True
End If
Else
Low_Handle = False
MsgBox LoadResString(161), , LoadResString(124)
Exit Function
End If
Else
If IsNumeric(Val(stext)) Then
If Val(stext) < 0 Or Val(stext) * 1000 <> CLng(Val(stext) * 1000) Then
Low_Handle = False
MsgBox LoadResString(161), , LoadResString(124)
Exit Function
Else
pos = InStr(stext, ".")
If pos = 0 Then
ParaLow_W = Val(stext)
ParaLowE_W = 0
Else
ParaLow_W = Val(stext) * 10 ^ (Len(stext) - pos)
ParaLowE_W = -(Len(stext) - pos)
End If
Low_Handle = True
End If
Else
Low_Handle = False
MsgBox LoadResString(161), , LoadResString(124)
Exit Function
End If
End If
End Function
Public Function ParaBaud_W(stext As String) As Byte
If stext = "19200" Then
ParaBaud_W = 0
ElseIf stext = "9600" Then
ParaBaud_W = 1
ElseIf stext = "4800" Then
ParaBaud_W = 2
ElseIf stext = "2400" Then
ParaBaud_W = 3
ElseIf stext = "1200" Then
ParaBaud_W = 4
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -