2-29
Sample Programs
BASIC Programming Examples
320 ! BEGIN SUBPROGRAMS
330 !
340 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
350 !
360 !
370 ! Subprogram name: Initialize
380 ! Parameters: none
390 ! Return value: none
400 ! Description: This routine initializes the interface and the scope. The instrument
410 ! is reset to a known state and the interface is cleared. System headers
420 ! are turned off to allow faster throughput and immediate access to the
430 ! data values requested by the queries. The analyzer time base,
440 ! channel, and trigger subsystems are then configured. Finally, the
450 ! acquisition subsystem is initialized.
460 !
470 !
480 SUB Initialize
490 COM /Io/@Scope,@Path,Interface
500 COM /Variables/ REAL Xinc,Xref,Xorg,Yinc,Yref,Yorg
510 COM /Variables/ INTEGER Record_length
520 Interface=7
530 ASSIGN @Scope TO 707
540 RESET Interface
550 CLEAR @Scope
560 OUTPUT @Scope;"*RST"
570 OUTPUT @Scope;"*CLS"
580 OUTPUT @Scope;":SYSTem:HEADer OFF"
590 !Initialize Timebase: center reference, 2 ms full-scale (200 us/div), 20 us delay
600 OUTPUT @Scope;":TIMebase:REFerence CENTer;RANGe 2e-3;POSition 20e-6"
610 ! Initialize Channel1: 1.6V full-scale (200mv/div), -415mv offset
620 OUTPUT @Scope;":CHANnel1:RANGe 1.6;OFFSet -415e-3"
630 !Initialize Trigger: Edge trigger, channel1 source at -415mv
640 OUTPUT @Scope;":TRIGger:SOURce FPANel;SLOPe POSitive"
650 OUTPUT @Scope;":TRIGger:LEVel-0.415"
660 ! Initialize acquisition subsystem
665 ! Real time acquisition, Averaging off, memory depth 4096
670 OUTPUT @Scope;":ACQuire:AVERage OFF;POINts 4096"
680 Record_length=4096
690 SUBEND
700 !
710 !
720 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
730 !
740 !
750 ! Subprogram name: Acquire_data
760 ! Parameters: none
770 ! Return value: none
780 ! Description: This routine acquires data according to the current instrument
790 ! setting. It uses the root level :DIGitize command. This command
800 ! is recommended for acquisition of new data because it will initialize
810 ! the data buffers, acquire new data, and ensure that acquisition
820 ! criteria are met before acquisition of data is stopped. The captured
830 ! data is then available for measurements, storage, or transfer to a
840 ! PC. Note that the display is automatically turned off by the :DIGitize
850 ! command and must be turned on to view the captured data.
860 !