POLARIZATION EXTINCTION RATIO METER PEM-320
9-3
9.2. RS-232C Program
The following program provides an example of the use of the Control Commands for RS-232C
communication. The program is written in Visual Basic and has an output function to read the
polarization extinction ratio and an input function to set the measurement speed to 5Hz. The
communications port in this example is Com1 and requires the ActiveX MSComm component to be
included in the program.
‘Read PER Routine
‘Subroutine description
Private Sub PER_Read_dB()
‘Sets routine name to
PER_Read_dB
‘Define Variables
‘Comment
Dim ans As String * 30
‘Dimensions ans array as
String of length 30
‘Read PER Subroutine
‘Comment
Form1.MSComm1.PortOpen = True
‘Open communication port
MSComm1 of Form1
Form1.MSComm1.Output = “PE” + Chr$(&HD)
‘Set output variable to PER
in dB (CR delimiter)
Form1.MSComm1.Output = “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
ans = Form1.MSComm1.Input
‘Read data from MSComm1 port
MsgBox (“PER = “ & ans)
‘Output read data to screen
Form1.MSComm1.PortOpen = False
‘Close communication port
E n d S u b
‘ E n d s u b r o u t i n e
‘Set Measurement Speed Routine
‘Subroutine description
Private Sub MeasurementSpeed_Set()
‘Sets routine name to
MeasurementSpeed_Set
Form1.MSComm1.PortOpen = True
‘Open communication port
MSComm1 in Form1 of program
Form1.MSComm1.Output = “RF1” + Chr$(&HD)
‘Set measurement speed to
5Hz (CR delimiter)
Form1.MSComm1.PortOpen = False
‘Close communication port
End Sub
‘End Subroutine
Содержание PEM-320
Страница 2: ...PEM 320 Polarization Extinction Ratio Meter Operation Manual...
Страница 7: ...PEM 320 Operation Manual...
Страница 9: ...1 2 PEM 320 Operation Manual...
Страница 11: ...2 2 PEM 320 Operation Manual...
Страница 33: ...8 6 PEM 320 Operation Manual...
Страница 37: ...9 4 PEM 320 Operation Manual...
Страница 41: ...10 4 PEM 320 Operation Manual...
Страница 43: ...11 2 PEM 320 Operation Manual...
Страница 45: ...12 2 PEM 320 Operation Manual...