15: If MSComm1.PortOpen = False Then
16:
17: MSComm1.PortOpen = True
18: Else
19: MSComm1.PortOpen = False
20: End If
21:
22: End If
4.3.5.7
Data Parsing Example
Here we have an example of a code that parses incoming data.
Notice that it makes use of our generic input and output routines.
The important consideration is to gracefully handle corrupted input
data after a noise event. In this case we may get data, so a test
against empty string returns false, but we may not get commas in
the correct place. Notice that we register an error handler on line 26
so that the mid function, which would raise an error when given a
negative number, is handled.
1: Private Sub btn_EMI_Click()
2: Dim temp2$
3: Dim Response1$
4: Dim Response2$
5: Dim number$
6: Dim Comma
7: Dim CommaPos
8: Dim Start
9: Dim ODATA$
10:
11: Comma = ","
12: Start = 5
13:
14: If tmr_RCVTIMER.Enabled = True Then
tmr_RCVTIMER.Enabled = False
15: If tmr_NETRCVTMR.Enabled = True Then
tmr_NETRCVTMR.Enabled = False
16:
17: If AutoUpdate = True Then
18: tmr_UPDATE.Enabled = False
19: End If
20:
21: number$ = "15,"
22: outputOutputString (number$)
23:
24: temp2$ = inputInputString
25: CommaPos = InStr(Start, temp2$, Comma, vbTextCompare)
118080-001 REV A
Page 35 of 95
Содержание SLM SERIES
Страница 15: ...SLM MANUAL 6 118073 001 Rev C Figure 2 2 Unit Dimensions 1200W ...
Страница 19: ...SLM MANUAL 10 118073 001 Rev C Figure 3 3 Local Programming via External Voltage Source ...
Страница 20: ...SLM MANUAL 11 118073 001 Rev C Figure 3 4 Remote Monitoring ...
Страница 40: ...Figure 9 Web Page 1 Contact Information 118080 001 REV A Page 13 of 95 ...
Страница 46: ...4 2 2 9 About Displays version information and model number Figure 15 About 118080 001 REV A Page 19 of 95 ...
Страница 98: ...Request Faults 68 20 ASCII 118080 001 REV A Page 71 of 95 ...