Appendix A — Examples A-3 Visual Basic
S331L PM PN: 10580-00322 Rev. F A-9
MsgBox "Connect load at port 1"
sInputString = ":SENSe:CORRection:COLLect:LOAD"
stat = viWrite(sesn, sInputString, Len(sInputString), retCount)
Do
Sleep (200)
'wait load measurement to complete and returns 1
sInputString = ":SENSe:CORRection:COLLect:STATus? LOAD"
stat = viWrite(sesn, sInputString, Len(sInputString), retCount)
stat = viRead(sesn, Buffer, MAX_CNT, retCount)
Loop Until Val(Buffer) = 1
'Save and apply calibration
sInputString = ":SENS:CORR:COLL:SAV"
stat = viWrite(sesn, sInputString, Len(sInputString), retCount)
'Wait for previous operation to be completed
sInputString = "*OPC?"
stat = viWrite(sesn, sInputString, Len(sInputString), retCount)
Buffer = ""
stat = viRead(sesn, Buffer, MAX_CNT, retCount)
'read back the the cal type (i.e. Buffer = 1, RFP1 or one-port
calibration)
sInputString = ":SENS:CAL:STAT?"
stat = viWrite(sesn, sInputString, Len(sInputString), retCount)
Buffer = ""
stat = viRead(sesn, Buffer, MAX_CNT, retCount)
Rem Close down the system
stat = viClose(sesn)
stat = viClose(dfltRM)
End Sub