Chapter 3 Programming Your Universal Counter for Remote Operation

Elements of SCPI Commands

Easiest Way to Make a Measurement (HP BASIC) (Continued)

540 ! The following commands will measure the frequency on channel 1.

550 ! The MEAS? query can be broken down into CONF and READ? commands.

560 ! The CONF and READ? allow more flexibility than the MEAS? query.

570 ! CONF can be used to configure a measurement. Additional commands 580 ! can then be issued to fine tune the measurement setup. The READ?

590 ! command than reads the result. In the following example, a frequency 600 ! measurement is configured, then, as an example for changing the setup 610 ! created by the CONF command, the counter is programmed for a trigger 620 ! level of 50 mV. (The CONF command tells the counter to use the AUTO 630 ! trigger level mode) Finally, the data is read using the READ? command. 640 PRINT

650 PRINT "Frequency measured using CONF:FREQ (@1) and READ?"

660OUTPUT @Count;"CONF:FREQ (@1)" ! Configure for frequency measurement

670OUTPUT @Count;":EVENT1:LEVEL .05" ! Set trigger level to 50 mV

680 OUTPUT @Count;"READ?"

! Ask for data

690ENTER @Count;Freq$

700PRINT

710PRINT "Frequency = ";Freq$

720PRINT

730RETURN

740!

750!

760Init_fetc:! Use INIT and FETCH to read frequency and period

770! The READ? command can be broken down into INIT and FETCH?, providing

780! even more measurement flexibility. By using FETCH?, you can retrieve

790! results based on already acquired data. For example, period can be

800! derived from a frequency measurement, without a new acquisition.

810! The following example uses CONF to set up a frequency measurement.

820! The trigger level is then changed to -50 millivolts and an INIT is

830! performed, starting the measurement process. The data is read using

840! the FETCH:FREQUENCY? command. The period can then be read by sending

850! FETCH:PERIOD?, this time asking for the period.

860PRINT

870PRINT "Frequency and Period measured using CONF:FREQ (@1), INIT, FETCH?"

880OUTPUT @Count;"CONF:FREQ (@1)" ! Configure for frequency measurement

890OUTPUT @Count;":EVENT1:LEVEL -.05"! Change trigger level

900 OUTPUT @Count;"INIT"

! Start a measurement

910OUTPUT @Count;"FETCH:FREQUENCY?" ! Ask for frequency result

920ENTER 703;Freq$

930PRINT

940PRINT "Frequency = ";Freq$

950

OUTPUT @Count;"FETCH:PERIOD?"

! Ask for period result derived from

960

 

! frequency measurement. Note that

970

 

! another measurement was not made.

980ENTER @Count;Period$

990PRINT

1000 PRINT "Period = ";Period$

1010 PRINT

1020 RETURN

1030 END

Programming Guide

3-61