📄 moddeclarations.bas
字号:
Attribute VB_Name = "modDeclarations"
Option Explicit
Public ReceiveWindowCharLimit As Integer
Public ScrollWindowCharLimit As Long
Public txtScrollHeading As String
Public OpenPortStatus As Integer
Public CommPorts() As String
Public PortNumber As Integer
Public NumberOfPorts As Integer
Public PP As Integer
Public NumDataBytes As Integer
Public mDTRWaitTime As Integer
Public mBaud As Long
Public mComPort As Integer
Public mV3Zero As Integer
Public mCSEnable As Integer
Public mDTREnable As Integer
Public mMainShow As Boolean
Public V1 As Double
Public V2 As Double
Public V3 As Double
Public V3Range As Integer
Public I1 As Double
Public Hz As Double
Public SampleCount As Long
Public V1Max As Double
Public V1Avg As Double
Public V1Min As Double
Public V1Total As Double
Public V2Max As Double
Public V2Avg As Double
Public V2Min As Double
Public V2Total As Double
Public V3Max As Double
Public V3Avg As Double
Public V3Min As Double
Public V3Total As Double
Public I1Max As Double
Public I1Avg As Double
Public I1Min As Double
Public I1Total As Double
Public HzMax As Double
Public HzAvg As Double
Public HzMin As Double
Public HzTotal As Double
Public LogicPtr As Integer
Public LogicTimeStart As Long
Public LogicTime As Long
Public Millisecs As Integer
Public Seconds As Integer
Public Minutes As Integer
Public Hours As Integer
Public FreeSeconds As Long
Public FreeMillisecs As Long
Public ByteArray(0 To 255) As Byte
Public RcvBuff As String
Public LoopTime As Double
Public Filename As String
Public ChartArray(0 To 4, 0 To 600) As Double
Public MaxCol As Integer
Public ArrayCol As Integer
Public Mode As String
' Global xdebug collection
Public Sub Main()
'xDebug.Print "Main"
Call Initialize
frmScroll.Show
End Sub
Public Sub Initialize()
Dim j As Integer
Call FindPorts
mBaud = 115200
mComPort = 1
Filename = App.Path & "/MultiMtr.cfg"
LoadConfigFile (App.Path & "/MultiMtr.cfg")
Debug.Print "Comm - Baud, Port: ", mBaud, mComPort
RcvBuff = ""
ReceiveWindowCharLimit = 400
ScrollWindowCharLimit = 30000
If frmComm.MSComm1.PortOpen = True Then frmComm.MSComm1.PortOpen = False
OpenPortStatus = frmComm.fncInitializeComPort(mBaud, mComPort)
ArrayCol = 0
MaxCol = 60
Mode = "Volt1"
Call frmScroll.MinMaxReset
' ChartArray(2, 1) = 2
' ChartArray(2, 2) = 20
' ChartArray(2, 3) = 15
' ChartArray(2, 4) = 27
' ChartArray(1, 1) = 3
' ChartArray(1, 2) = 22
' ChartArray(1, 3) = 18
' ChartArray(1, 4) = 24
' ChartArray(0, 1) = 4
' ChartArray(0, 2) = 24
' ChartArray(0, 3) = 20
' ChartArray(0, 4) = 22
' frmChart.Chart.ChartData = ChartArray
End Sub
Public Sub ShutDownComm()
If frmComm.MSComm1.PortOpen = True Then frmComm.MSComm1.PortOpen = False
Unload frmComm
End Sub
Public Sub LoadConfigFile(Filename As String)
Dim j As Integer
Dim k As Integer
Dim k2 As Integer
On Error GoTo ErrorHandler
Open Filename For Input As #1
Dim S, S1, S2, S3 As String
Input #1, S1, S2, S3
mBaud = Val(S1)
mComPort = Val(S2)
mV3Zero = Val(S3)
If (mComPort < 1 Or mComPort > 8) Then
mBaud = 115200
mComPort = 1
Close #1
Exit Sub
End If
Close #1
Exit Sub
ErrorHandler: ' Skip file load - use built in defaults
Debug.Print "File Read Error"
mBaud = 115200
mComPort = 1
mV3Zero = 3
Close #1
End Sub
Public Sub SaveConfigFile(Filename As String)
Dim j As Integer
Dim k As Integer
Dim S As String
'This section opens and overwrites the file with the config information
Open Filename For Output As #1
S = Str(mBaud) & "," & Str(mComPort) & "," & Str(mV3Zero)
Print #1, S
'xDebug.Print "Save - numpackets-", mNumPackets
Close #1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -