9-4
ECL-210 Operation Manual
‘READ POWER (dBm) ROUTINE
‘Subroutine description
Private Sub Power_Read_dBm()
‘Sets routine name to
Power_Read_dBm
‘Define Variables
‘Comment
Dim ans As String * 30
‘Dimensions ans array as
String of length 30
‘Read Actual Power Subroutine
‘Comment
Form1.MSComm1.PortOpen = True
‘
Open port MSComm1 of Form1
Form1.MSComm1.Output = “A:OP” + Chr$(&HD)
‘
Set output variable to actual
output power in dBm.
Form1.MSComm1.Output = “A:DI” + Chr$(&HD)
‘Send receive data command
for RS-232 (echo back)
For I = 1 To 1000000
‘
Delay to wait for echo back
Next I
ActualPower_dBm = Form1.MSComm1.Input
‘
Read data from MSComm1 port
MsgBox (“Actual Power = “ & ActualPower_dBm)
‘
Output read data to screen
Form1.MSComm1.PortOpen = False
‘Close communication port
‘Read Target Power Subroutine
‘Comment
Form1.MSComm1.PortOpen = True
‘
Open port MSComm1 of Form1
Form1.MSComm1.Output = “A:OPT” + Chr$(&HD)
‘
Set output variable to target
output power in dBm.
Form1.MSComm1.Output = “A:DI” + Chr$(&HD)
‘Send receive data command
for RS-232 (echo back)
For I = 1 To 1000000
‘
Delay to wait for echo back
Next I
TargetPower_dBm = Form1.MSComm1.Input
‘
Read data from MSComm1 port
MsgBox (“Power = “ & TargetPower_dBm)
‘
Output read data to screen
Form1.MSComm1.PortOpen = False
‘Close communication port
End Sub
‘End subroutine
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com