/* Pseudo-Code Agilent 4156C QSCV */ /* Bill Tompkins 6/2014 */ /* Use code at your own risk */ /* Initial Set Up of the Agilent 4156C */ Write(AddLineFeed("*RST")); //Reset 4156 Write(AddLineFeed(":CAL:AUTO ON")); //Set Auto Calibration Write(AddLineFeed(":PAGE:CHAN:MODE SWEEP")); //Sets to Sweep Measurment Mode Write(AddLineFeed(":PAGE:DISP:MODE GRAP")); //Display Mode - Graphics Write(AddLineFeed(":PAGE:CHAN:SMU1:VNAM " & "'VSMU1'")); //Initial Set Up Write(AddLineFeed(":PAGE:CHAN:SMU1:INAM " & "'ISMU1'")); Write(AddLineFeed(":PAGE:CHAN:SMU1:MODE COMM")); Write(AddLineFeed(":PAGE:CHAN:SMU2:VNAM " & "'VSMU2'")); //Set Up Channel Write(AddLineFeed(":PAGE:CHAN:SMU2:INAM " & "'ISMU2'")); Write(AddLineFeed(":PAGE:CHAN:SMU2:MODE V")); Write(AddLineFeed(":PAGE:CHAN:SMU3:VNAM " & "'VSMU3'")); //Set Up Channel Write(AddLineFeed(":PAGE:CHAN:SMU3:INAM " & "'ISMU3'")); Write(AddLineFeed(":PAGE:CHAN:SMU3:MODE V")); Write(AddLineFeed(":PAGE:CHAN:SMU4:VNAM " & "'VSMU4'")); //Set Up Channel Write(AddLineFeed(":PAGE:CHAN:SMU4:INAM " & "'ISMU4'")); Write(AddLineFeed(":PAGE:CHAN:SMU4:MODE COMM")); Write(AddLineFeed(":PAGE:CHAN:SMU1:FUNC CONS")); //Set Up Channel Write(AddLineFeed(":PAGE:CHAN:SMU2:FUNC CONS")); Write(AddLineFeed(":PAGE:CHAN:SMU3:FUNC CONS")); Write(AddLineFeed(":PAGE:CHAN:SMU4:FUNC CONS")); Write(AddLineFeed(":PAGE:CHAN:SMU2:FUNC VAR1")); Write(AddLineFeed(":PAGE:MEAS:VAR1:SPAC LIN")); //Sweep Mode Linear Write(AddLineFeed(":PAGE:MEAS:VAR1:STAR 0.0")); //Set Sweep Start Write(AddLineFeed(":PAGE:MEAS:VAR1:STOP 1.0")); //Set Sweep Stop Write(AddLineFeed(":PAGE:MEAS:VAR1:STEP 0.25")); //Set Sweep Step Write(AddLineFeed(":PAGE:MEAS:VAR1:COMP 0.01")); //Set Sweep Complinace Write(AddLineFeed(":PAGE:MEAS:MSET:SMU1:RANG:MODE FIXED")); //Measurement Range Type Write(AddLineFeed(":PAGE:MEAS:MSET:SMU1:RANG 1E-3")); //Set Measurment Range Write(AddLineFeed(":PAGE:MEAS:MSET:SMU2:RANG:MODE FIXED")); //Measurement Range Type Write(AddLineFeed(":PAGE:MEAS:MSET:SMU2:RANG 1E-3")); //Set Measurment Range Write(AddLineFeed(":PAGE:MEAS:MSET:ITIM SHORT")); //Set Integration Time Write(AddLineFeed(":PAGE:MEAS:DEL 0")); //Measurement Delay (sec) Write(AddLineFeed(":PAGE:MEAS:HTIM 0")); //Hold Time (sec) Write(AddLineFeed(":PAGE:DISP:GRAP:X:NAME " & "'VSMU2'")); //Sets Display X Axis Name Write(AddLineFeed(":PAGE:DISP:GRAP:Y1:NAME " & "'ISMU2'")); //Sets Display Sets Y1 Axis Name Write(AddLineFeed(":PAGE:DISP:GRAP:X:SCAL LIN")); //Sets X Axis Scale - Linear Write(AddLineFeed(":PAGE:DISP:GRAP:Y1:SCAL LIN")); //Sets Y1 Axis Scale - Linear Write(AddLineFeed(":PAGE:DISP:GRAP:X:MIN 0.0")); //Sets X Min Value Write(AddLineFeed(":PAGE:DISP:GRAP:X:MAX 1.0")); //Sets X Max Value Write(AddLineFeed(":PAGE:DISP:GRAP:Y1:MIN -0.001")); //Sets Y1 Min Value Write(AddLineFeed(":PAGE:DISP:GRAP:Y1:MAX +0.001")); //Sets Y1 Max Value Write(AddLineFeed(":PAGE:GLIS")); //Set to Graphic Display Write(AddLineFeed(":DISP OFF")); //Update Display /* QSCV Set UP */ Write(AddLineFeed(":PAGE:CHAN:SMU1:DIS")); //Channel Disable for SMU1 Write(AddLineFeed(":PAGE:CHAN:SMU2:DIS")); //Channel Disable for SMU1 Write(AddLineFeed(":PAGE:CHAN:SMU3:VNAM " & "'VSMU3'")) Write(AddLineFeed(":PAGE:CHAN:SMU3:INAM " & "'ISMU3'")) Write(AddLineFeed(":PAGE:CHAN:SMU3:MODE V")); //Set Channel 3 to Voltage Mode Write(AddLineFeed(":PAGE:CHAN:SMU3:FUNC VAR1")); //Set Channel 3 to VAR1 Write(AddLineFeed(":PAGE:CHAN:SMU4:VNAM " & "'VSMU4'")) Write(AddLineFeed(":PAGE:CHAN:SMU4:INAM " & "'ISMU4'")); Write(AddLineFeed(":PAGE:CHAN:SMU4:MODE COMM")); //Set Channel 4 to Common Mode Write(AddLineFeed(":PAGE:CHAN:SMU4:FUNC CONS")); //Set Channel 4 to Constant Write(AddLineFeed(":PAGE:CHAN:MODE QSCV")); //Sets to QSCV Measurment Mode Write(AddLineFeed(":PAGE:MEAS:QSCV:UNIT DEF")); //Sets QSCV Measurment Channel (DEF = VAR1) Write(AddLineFeed(":PAGE:MEAS:QSCV:CNAME 'CAP34'")); //Sets QSCV Variable Name Write(AddLineFeed(":PAGE:MEAS:QSCV:LNAME 'LEAK34'")); //Sets QSCV Leakage Current Variable Name Write(AddLineFeed(":PAGE:MEAS:QSCV:CINT .75")); //Sets QSCV Integration Time (Sec) - reasonable guess for pF level measurement Write(AddLineFeed(":PAGE:MEAS:QSCV:IINT .75")); //Sets QSCV Integratin Time for Leakage Current - reasonable guess for pF level measurement Write(AddLineFeed(":PAGE:MEAS:QSCV:SST OFF")); /Sets QSCV Stop Condition Write(AddLineFeed(":PAGE:MEAS:QSCV:DEL 0.1")); //Sets QSCV Delay Value (Sec) Write(AddLineFeed(":PAGE:MEAS:QSCV:HTIM 0.1")); //Sets QSCV Hold Time Value (Sec) Write(AddLineFeed(":PAGE:MEAS:QSCV:LCAN ON")); //Enables QSCV Leakage Current Compensation Write(AddLineFeed(":PAGE:MEAS:QSCV:ZCAN ON")); //Sets QSCV Offset Capacitance Cancel Mode Write(AddLineFeed(":PAGE:MEAS:QSCV:RANG 10E-12")); //Sets QSCV Set Measurment Range (F) Write(AddLineFeed(":PAGE:MEAS:QSCV:VAR1:MODE SING")); //Sets QSCV Sweep Mode Write(AddLineFeed(":PAGE:MEAS:QSCV:VAR1:START -3")); //Sets QSCV VAR Sweep Start Value (V) Write(AddLineFeed(":PAGE:MEAS:QSCV:VAR1:STOP 3)); //Sets QSCV VAR Sweep Stop Value (V) Write(AddLineFeed(":PAGE:MEAS:QSCV:VAR1:STEP 0.25)); //Sets QSCV VAR Sweep Step Value (V) Write(AddLineFeed(":PAGE:MEAS:QSCV:VAR1:COMP 0.1")); //Sets QSCV VAR Sweep Compliance (A) Write(AddLineFeed(":PAGE:MEAS:QSCV:VAR1:CSTE " & 0.25)); //Sets QSCV Capacitance Mesurment Voltage Write(AddLineFeed(":PAGE:DISP:GRAP:X:NAME " & "'VSMU3'")); //Sets X Axis Name Write(AddLineFeed(":PAGE:DISP:GRAP:Y1:NAME " & "'CAP34'")); //Sets Y1 Axis Name Write(AddLineFeed(":PAGE:DISP:GRAP:X:SCAL LIN")); //Sets X Axis Scale - Linear Write(AddLineFeed(":PAGE:DISP:GRAP:Y1:SCAL LIN")); //Sets Y1 Axis Scale - Linear Write(AddLineFeed(":PAGE:DISP:GRAP:X:MIN -3)); //Sets X Min Value Write(AddLineFeed(":PAGE:DISP:GRAP:X:MAX 3)); //Sets X Max Value Write(AddLineFeed(":PAGE:DISP:GRAP:Y1:MIN 0)); //Sets Y1 Min Value Write(AddLineFeed(":PAGE:DISP:GRAP:Y1:MAX 50E-12)); //Sets Y1 Max Value /* Actual Measurement Routine */ Write(AddLineFeed("*ESE 1")) Write(AddLineFeed("*CLS")) Write(AddLineFeed(":PAGE:GLIS")); //Set to Graphic Display Write(AddLineFeed(":PAGE:SCON:MEAS:SING")); //Trigger Single sweep Write(AddLineFeed(":DISP ON")); //Update display Write(AddLineFeed("*OPC")); //Setting Up for SerialPoll For(;;){ Delay(0.1); //Delay in mS if(SerialPoll() And SRQ_BIT5) //Polling Service Request Bit 5, Command Ready - Sweep Complete exitfor; } Write(AddLineFeed("*CLS")); //Clear Buffer Write(AddLineFeed(":DISP OFF")); //Update display - Off Write(AddLineFeed(":FORM:DATA ASC")); //Format Output Data as ASCII Write(AddLineFeed(":DATA? 'VSMU3'")); //Output Voltage Data RemoveEOL(ReadString(5000)); //Read Input String (5000 Char Max.) Write(AddLineFeed(":DATA? 'CAP34'")); //Output Capacitance Data RemoveEOL(ReadString(5000)); //Read Input String (5000 Char Max.) Write(AddLineFeed(":DATA? 'LEAK34'")); //Output Leakage Current Data RemoveEOL(ReadString(5000)); //Read Input String (5000 Char Max.) Write(AddLineFeed(":SYST:ERR?")); //Read Error String RemoveEOL(ReadString(5000)); //Read Input String (5000 Char Max.)