7352 Series Digital Multimeter Operation Manual
6.7.3 Sample Programs (RS-232)
6-61
.PortOpen = False
'Closes the port.
End With
End With
End Sub
-------------------------------------------------------------------------------
Private Sub rx_prompt()
'Subroutine for receiving a prompt
Dim prompt As String
Do
If UserForm1.MSComm1.InBufferCount >= 5 Then
'If there is received data, reads it.
prompt = UserForm1.MSComm1.Input
'Reads data from the receiving buffer.
If InStr(prompt, "=>") Then
'Checks whether "=>" is received.
Exit Do
'Exits Do While Loop.
End If
End If
Loop
End Sub
-------------------------------------------------------------------------------
Private Sub rx_data(dt As String, dt_len As Integer)
'Subroutine for receiving data and a prompt
Do
If UserForm1.MSComm1.InBufferCount >= (5 + dt_len) Then
'If there is received data, reads it.
dt$ = UserForm1.MSComm1.Input
'Reads data from the receiving buffer.
If InStr(dt, "=>") Then
'Checks whether "=>" is received.
dt = Mid(dt, 2, dt_len)
'Separates a prompt from received data.
Exit Do
'Exits Do While Loop.
End If
End If
Loop
End Sub