Chapter 3 Programming Your Universal Counter for Remote Operation

Elements of SCPI Commands

To Use Limits to Filter Data Before Measuring Stats (HP

BASIC) (Continued)

500

OUTPUT @Count;":CALC3:LFIL:STATE ON"

!

Enable statistics filter

510

OUTPUT @Count;":CALC3:LFIL:LOWER ";Lower

!

Set the lower limit

520

OUTPUT @Count;":CALC3:LFIL:UPPER ";Upper

!

Set the upper limit

530

OUTPUT @Count;":CALC3:AVER ON"

 

!

Enable statistics

540

OUTPUT @Count;":CALC3:AVER:COUNT ";Num_meas!

Set number of

550

 

 

 

!

measurements for stats.

560

OUTPUT @Count;":CALC2:LIM:STATE ON"

!

Enable limit testing. This

570

 

 

 

!

must happen in order to

580

 

 

 

!

see the limit graph.

590

OUTPUT @Count;":CALC2:LIM:LOWER ";Lower

!

Set the limits lower limit

600

OUTPUT @Count;":CALC2:LIM:UPPER ";Upper

!

Set the limits upper limit

610

OUTPUT @Count;":CALC2:LIM:DISP GRAPH"

! Display the limit graph

620

!

 

 

 

 

630

ON INTR 7 GOTO Stats_ready

! Where to go when statistics ready

640

ENABLE INTR 7;2

 

! Enable interrupt on SRQ

650

PRINT "Waiting for measurement to complete"

 

 

660

OUTPUT @Count;":INIT:CONT ON"

! Set counter to RUN

670

Loop_here: !WAITING FOR STATISTICS TO COMPLETE

 

680

GOTO Loop_here

 

 

 

 

690

!

 

 

 

 

700

Stats_ready:

!Statistics are ready

 

 

710

S=SPOLL(703)

! Serial poll to see if correct bit is set.

720OUTPUT @Count;":INIT:CONT OFF" ! Stop making new measurements

730OUTPUT @Count;":CALC3:AVERAGE:TYPE MAX;:CALC3:DATA?"

740ENTER @Count;Maximum$

750OUTPUT @Count;":CALC3:AVERAGE:TYPE MIN;:CALC3:DATA?"

760ENTER @Count;Minimum$

770OUTPUT @Count;":CALC3:AVERAGE:TYPE MEAN;:CALC3:DATA?"

780ENTER @Count;Mean$

790OUTPUT @Count;":CALC3:AVERAGE:TYPE SDEV;:CALC3:DATA?"

800ENTER @Count;Sdev$

810PRINT

820

PRINT "Serial Poll Result = ";S

! Should be

192

830

PRINT

 

 

840

PRINT USING "21A,22A,X,8A";"Minimum Period

= ";Minimum$;" seconds"

850

PRINT USING "21A,22A,X,8A";"Maximum Period

= ";Maximum$;" seconds"

860

PRINT USING "21A,22A,X,8A";"Mean Period

= ";Mean$;" seconds"

870

PRINT USING "21A,22A,X,8A";"Standard Deviation = ";Sdev$;" seconds"

880

LOCAL 703

! Put counter is local

890

END

 

 

Programming Guide

3-67