99
────────────────────────────────────────────────────
7.7 Sample Program
────────────────────────────────────────────────────
sp.WriteLine(":HEAD OFF") ’Select internal triggering
sp.WriteLine(":MODE RV") ’Resistance and Vooltage Measurement
sp.WriteLine(":HOLD OFF") ’Measurement Hold OFF
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
End Sub
‘Close program when Button2 is pressed
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Me.Dispose()
End Sub
End Class
(a) This makes it so that during communication the [ Begin
Measurement ] and [ Close ] buttons cannot be pressed.
(b) Matches the 3560 communication conditions and the computer usage
conditions.
The port to be used on the computer: 1
Transmission speed: 9600 bps
Parity: none
Data length: 8 bit
Stop bit: 1bit
(c) Sets CR + LF as the terminator indicating the end of the sending and
receiving character string.
(d) Sets the reading time out time to 2 seconds.
(e) Opens the "data.csv" file. However, if a file with this name already
exists, the previous "data.csv" will be deleted and a new file created.
(f) Sends the command to the 3560 to perform most recent return that
measurement result to the computer.