📄 frmscroll.frm
字号:
Height = 615
Left = 195
TabIndex = 3
Top = 1140
Width = 735
End
Begin VB.Menu File
Caption = "File"
End
Begin VB.Menu Config
Caption = "Config"
End
Begin VB.Menu Terminal
Caption = "Terminal"
End
Begin VB.Menu Chart
Caption = "Chart"
End
Begin VB.Menu Logic
Caption = "Logic"
End
Begin VB.Menu Help
Caption = "Help"
End
Begin VB.Menu About
Caption = "About"
End
End
Attribute VB_Name = "frmScroll"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub btnFreqGen_Click()
If optKHz = True Then
txtFreqActual.Text = Format(7350 / ((7350 \ Val(txtFreq.Text)) + 1), "####.00")
Else
txtFreqActual.Text = Format(28794 / ((28794 \ Val(txtFreq.Text)) + 1), "####.00")
End If
PutStr ("e")
If optKHz = True Then
PutStrCR ("1")
Else
PutStrCR ("0")
End If
Delay (100)
PutStrCR ("f" & txtFreq.Text)
End Sub
Private Sub btnLogicArm_Click()
Mode = "Logic"
PutStrCR ("a" & txtNumLogicSamples.Text)
frmPElogic.Show vbModeless
End Sub
Private Sub btnLogicDone_Click()
Mode = "Volt1"
End Sub
Private Sub btnPrintToggle_Click()
PutStrCR ("p")
End Sub
Private Sub btnResetTimers_Click()
PutStrCR ("r")
End Sub
Private Sub btnSendDataRate_Click()
Dim S As String
LoopTime = CDbl(txtDataRate.Text / 7.81) ' 128 counts gives 1 second
S = RealToStr(LoopTime)
PutStrCR ("t" & S)
End Sub
Private Sub Chart_Click()
frmChartGiga.Show vbModeless
End Sub
Private Sub chkEnableFreqGen_Click()
If chkEnableFreqGen.Value = Checked Then
PutStr ("e")
If optKHz = True Then
PutStrCR ("1")
Else
PutStrCR ("0")
End If
Delay (100)
PutStrCR ("f" & txtFreq.Text)
Else
PutStrCR ("q")
End If
End Sub
Private Sub chkVoltMeter_Click()
If chkVoltMeter.Value = Checked Then
PutStrCR ("v")
Else
PutStrCR ("w")
End If
End Sub
Private Sub Help_Click()
'LastHelp = "\HelpOverview.rtf"
Load frmHelp
frmHelp.Show
End Sub
Private Sub About_Click()
Load frmAbout
frmAbout.Show
End Sub
Private Sub Config_Click()
Load frmConfig
frmConfig.Show
End Sub
Private Sub sclV3Zero_Change()
mV3Zero = sclV3Zero.Value
End Sub
Private Sub Terminal_Click()
Load frmTerminal
frmTerminal.Show
End Sub
Private Sub Logic_Click()
Load frmPElogic
frmPElogic.Show
End Sub
Private Sub Form_Load()
sclV3Zero.Value = mV3Zero
'xDebug.Print "Scroll Load"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call SaveConfigFile(Filename)
Call ShutDownComm
Unload frmComm
Unload frmChart
Unload frmChartGiga
Unload frmPElogic
Unload frmTerminal
End Sub
Public Sub Scroll_Rcvd(S As String)
Dim j As Integer
Dim TimeDate As String
'TimeDate = Format(Now, "General Date")
'If CharRcvd = Chr(1) Then CharRcvd = ''
frmTerminal.txtTerminal.Text = S & Chr(13) & Chr(10) _
& frmTerminal.txtTerminal.Text
If Len(frmTerminal.txtTerminal.Text) > ScrollWindowCharLimit Then
frmTerminal.txtTerminal.Text = left(frmTerminal.txtTerminal.Text, _
ScrollWindowCharLimit - 1000)
End If
End Sub
'T00:00:03:096 V1:00500 V2:00528 I1:0000
'T00:00:23:064 V1:00000 V2:00000 V3:00498 1 I1:00000 F0001003
'^ ^ ^ ^ ^ ^ ^
'1
Public Sub Calc(S As String)
Hours = Val(Mid(S, 2, 2))
Minutes = Val(Mid(S, 5, 2))
Seconds = Val(Mid(S, 8, 2))
Millisecs = Val(Mid(S, 11, 3))
V1 = Val(Mid(S, 18, 5)) / 100
V2 = Val(Mid(S, 27, 5)) / 100
V3 = (Val(Mid(S, 36, 5)) / 1000) + (mV3Zero / 1000)
V3Range = Val(Mid(S, 42, 2))
'xDebug.Print "V3Range ", V3Range, mV3Zero
I1 = Val(Mid(S, 47, 5)) / 1000
Hz = Val(Mid(S, 54, 8))
FreeSeconds = Hours * 3600 + Minutes * 60 + Seconds
FreeMillisecs = (FreeSeconds * 1000) + Millisecs
'xDebug.Print FreeMillisecs
SampleCount = SampleCount + 1
If SampleCount > 2 Then
If V1 > V1Max Then V1Max = V1
If V1 < V1Min Then V1Min = V1
If V2 > V2Max Then V2Max = V2
If V2 < V2Min Then V2Min = V2
If V3 > V3Max Then V3Max = V3
If V3 < V3Min Then V3Min = V3
If I1 > I1Max Then I1Max = I1
If I1 < I1Min Then I1Min = I1
If Hz > HzMax Then HzMax = Hz
If Hz < HzMin Then HzMin = Hz
V1Total = V1Total + V1
V1Avg = V1Total / (SampleCount - 2)
V2Total = V2Total + V2
V2Avg = V2Total / (SampleCount - 2)
V3Total = V3Total + V3
V3Avg = V3Total / (SampleCount - 2)
I1Total = I1Total + I1
I1Avg = I1Total / (SampleCount - 2)
HzTotal = HzTotal + Hz
HzAvg = HzTotal / (SampleCount - 2)
End If
End Sub
Public Sub CalcLogic(S As String)
Dim LogicLogic As Integer
LogicTime = (Val(Mid(S, 2, 5)) * 65536) + Val(Mid(S, 8, 5))
If LogicPtr <= 1 Then
LogicTimeStart = LogicTime
End If
LogicTime = (LogicTime - LogicTimeStart) / 14.7456
If LogicTime > 0 Then 'Ignores bad data
LogicLogic = Val(Mid(S, 14, 4))
'xDebug.Print "logicTime ", LogicPtr, LogicTime, LogicTimeStart, LogicLogic
ChartArray(0, LogicPtr) = LogicTime
ChartArray(1, LogicPtr) = Val(Mid(S, 17, 1))
ChartArray(2, LogicPtr) = Val(Mid(S, 16, 1)) + 1.5
ChartArray(3, LogicPtr) = Val(Mid(S, 15, 1)) + 3
ChartArray(4, LogicPtr) = Val(Mid(S, 14, 1)) + 4.5
'xDebug.Print ChartArray(0, LogicPtr), ChartArray(1, LogicPtr), _
ChartArray(2, LogicPtr), ChartArray(3, LogicPtr), _
ChartArray(4, LogicPtr)
End If
End Sub
Private Sub btnReset_Click()
Call MinMaxReset
End Sub
Public Sub DisplayMinMax()
If SampleCount > 2 Then
txtV1Max.Text = Format(V1Max, "###.00")
txtV1Avg.Text = Format(V1Avg, "###.00")
txtV1Min.Text = Format(V1Min, "###.00")
txtV2Max.Text = Format(V2Max, "###.00")
txtV2Avg.Text = Format(V2Avg, "###.00")
txtV2Min.Text = Format(V2Min, "###.00")
txtV3Max.Text = Format(V3Max, "###.000")
txtV3Avg.Text = Format(V3Avg, "##.000")
txtV3Min.Text = Format(V3Min, "##.000")
txtI1Max.Text = Format(I1Max, "##.000")
txtI1Avg.Text = Format(I1Avg, "##.000")
txtI1Min.Text = Format(I1Min, "##.000")
txtHzMax.Text = Format(HzMax, "######0")
txtHzAvg.Text = Format(HzAvg, "######0")
txtHzMin.Text = Format(HzMin, "######0")
End If
End Sub
Public Sub AlarmCalc()
Dim AlarmOn As Integer
AlarmOn = False
If V1 > Val(txtV1AlmHi) Then
txtV1AlmHi.BackColor = &HFF&
AlarmOn = True
Else
txtV1AlmHi.BackColor = &H80000005
End If
If V1 < Val(txtV1AlmLo) Then
txtV1AlmLo.BackColor = &HFF&
AlarmOn = True
Else
txtV1AlmLo.BackColor = &H80000005
End If
If V2 > Val(txtV2AlmHi) Then
txtV2AlmHi.BackColor = &HFF&
AlarmOn = True
Else
txtV2AlmHi.BackColor = &H80000005
End If
If V2 < Val(txtV2AlmLo) Then
txtV2AlmLo.BackColor = &HFF&
AlarmOn = True
Else
txtV2AlmLo.BackColor = &H80000005
End If
If V3 > Val(txtV3AlmHi) Then
txtV3AlmHi.BackColor = &HFF&
AlarmOn = True
Else
txtV3AlmHi.BackColor = &H80000005
End If
If V3 < Val(txtV3AlmLo) Then
txtV3AlmLo.BackColor = &HFF&
AlarmOn = True
Else
txtV3AlmLo.BackColor = &H80000005
End If
If I1 > Val(txtI1AlmHi) Then
txtI1AlmHi.BackColor = &HFF&
AlarmOn = True
Else
txtI1AlmHi.BackColor = &H80000005
End If
If I1 < Val(txtI1AlmLo) Then
txtI1AlmLo.BackColor = &HFF&
AlarmOn = True
Else
txtI1AlmLo.BackColor = &H80000005
End If
If Hz > Val(txtHzAlmHi) Then
txtHzAlmHi.BackColor = &HFF&
AlarmOn = True
Else
txtHzAlmHi.BackColor = &H80000005
End If
If Hz < Val(txtHzAlmLo) Then
txtHzAlmLo.BackColor = &HFF&
AlarmOn = True
Else
txtHzAlmLo.BackColor = &H80000005
End If
If AlarmOn = True Then Beep
End Sub
Public Sub MinMaxReset()
V1Max = 0
V1Min = 99999
V1Avg = 0
V1Total = 0
V2Max = 0
V2Min = 99999
V2Avg = 0
V2Total = 0
V3Max = 0
V3Min = 99999
V3Avg = 0
V3Total = 0
I1Max = 0
I1Min = 99999
I1Avg = 0
I1Total = 0
HzMax = 0
HzMin = 9999999
HzAvg = 0
HzTotal = 0
SampleCount = 0
End Sub
Public Sub UpdateChartArray()
Dim j As Integer
If ArrayCol = MaxCol Then
For j = 0 To MaxCol - 1
ChartArray(0, j) = ChartArray(0, j + 1)
ChartArray(1, j) = ChartArray(1, j + 1)
ChartArray(2, j) = ChartArray(2, j + 1)
ChartArray(3, j) = ChartArray(3, j + 1)
ChartArray(4, j) = ChartArray(4, j + 1)
Next
Else
ArrayCol = ArrayCol + 1
End If
ChartArray(0, ArrayCol) = FreeMillisecs
ChartArray(1, ArrayCol) = V1
ChartArray(2, ArrayCol) = V2
ChartArray(3, ArrayCol) = V3
ChartArray(4, ArrayCol) = I1
frmChart.Chart.ChartData = ChartArray
End Sub
'T00:01:04 V1:0 500
'T01:15:59:127 V1:00499 V2:00000 I1:00000
'T00:22:42 V1: 5V2: 0I1: 0
Public Function ReformatBuff(S As String)
frmScroll.txtV1.Text = Format(V1, "###.00")
frmScroll.txtV2.Text = Format(V2, "###.00")
If V3Range > 1 Then
frmScroll.txtV3.Text = Format(V3, "##.000")
Else
frmScroll.txtV3.Text = Format(V3, "###.00")
End If
frmScroll.txtV3Range.Text = Format(V3Range, "0")
frmScroll.txtI1.Text = Format(I1, "##.000")
frmScroll.txtHz.Text = Format(Hz, "######0")
RcvBuff = "T:" & Format(Str(FreeSeconds), " @@@@@@") & _
" V1:" & Format(Str(V1), " ##.00") & _
" V2:" & Format(Str(V2), " ##.00") & _
" V3:" & Format(Str(V3), " ##.00") & Format(Str(V3Range), " 0") & _
" I1:" & Format(Str(I1), " #.000") & _
" F" & Format(Str(Hz), " ######0")
'RcvBuff = Left(S, 13) & Format(Str(V1), " ##.00") & " V2:" & _
' Format(Str(V2), " ##.00") & " I1:" & Format(Str(I1), " #.000")
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -