Polarization Extinction Ratio Meter PEM-340
9-7
■
9-4-2 RS-232C sample program
Private Sub MSComm1_Init() ' <RS-232C port initialize routine>
MSComm1. CommPort = 1 '
Select RS-232C port 1 as communication port
MSComm1. Settings = " 9600, n, 8,1" ' set 9600bps, 8bit, np, s1
MSComm1. RThreshold = 1
MSComm1. Sthreshold = 1
End Sub
Private Sub Power_Read_PER() ' <PER read out routine>
MSComm1.PortOpen = True '
Open communication port
MSComm1.Output = "PE" & Chr$(&HD)
'
Set output variable to PER
MSComm1.Output = "DI" & Chr$(&HD) ' Send read out command
For I = 1 To 1000000 ' Wait for receiving data
Next I
ans = MSComm1.Input ' Receive data
MsgBox ("PER = " & ans) ' Display data in the message box
MSComm1. PortOpen = False ' Close communication port
End Sub