beautypg.com

GW Instek GSP-827 Programming Manual User Manual

Page 18

background image

Copyright 2003 GOODWILL INSTRUMENT CO., LTD.

End If

Delay 100

Loop Until MSComm1.InBufferCount = 0 Or Tout

ReadCOM = rdBuffer

End Function

'========================== Click “Test” bottom to execute this test =====================================

Private Sub cmdTest_Click()

Dim R As String

Text1.Text = ""

Text1.SelStart = 0

MSComm1.CommPort = 1

'Use PORT 1

MSComm1.Settings = "57600,N,8,1"

'Baud rate 57600 、No parity check、data bit 8、stop bit 1

MSComm1.InputLen = 0

'Read the whole buffer when “input” is in use

MSComm1.PortOpen = True

'Open COM Port

R = SendQuery("*IDN?")

'Query the unit information

Text1.SelText = R & vbCrLf

'Display the response on “text box”

SendCMD "MEAS:FREQ:CEN 1000 MHZ"

'Set Center Frequency at 1000MHz

R = SendQuery("MEAS:FREQ:CEN?")

'Query Center Frequency unit to kHz

Text1.SelText = R & vbCrLf

'Display the center frequency on “text box”

R = SendQuery("MEAS:TRA:READ?")

'Query Trace ADC data

Text1.SelText = R & vbCrLf

'Display the trace data on “text box”

MSComm1.PortOpen = False

'Terminate COM Port

End Sub