280
Chapter 6 Application Programs
Example: BASIC for Windows
6
990 PRINT "Triggered Burst - press CONTinue"
1000 !
1010 OUTPUT @Fgen;"output:state off" ! Turn OFF Output BNC
1020 OUTPUT @Fgen;"output:sync off" ! Disable Sync BNC
1030 OUTPUT @Fgen;"func square" ! Select square wave
1040 OUTPUT @Fgen;"frequency 20e3" ! 20kHz
1050 OUTPUT @Fgen;"volt 1;:volt:offset 0" ! 1Vpp and 0V offset
1060 OUTPUT @Fgen;"func:square:dcycle 20" ! 20% duty cycle
1070 OUTPUT @Fgen;"trig:sour bus" ! Bus triggering
1080 OUTPUT @Fgen;"burst:ncycles 3" ! Burst of 3 cycles per trigger
1090 OUTPUT @Fgen;"burst:state on" ! Enable Burst
1100 OUTPUT @Fgen;"output:state on" ! Turn ON Output BNC
1110 OUTPUT @Fgen;"output:sync on" ! Enable Sync BNC
1120 Check_errors ! Routine checks for errors
1130 FOR I=1 TO 20
1140 OUTPUT @Fgen;"*trg" ! Send BUS trigger
1150 WAIT .1 ! Wait 100msec
1160 NEXT I
1170 PAUSE
1180 !
1190 PRINT "Download 20 point Arbitrary waveform using ASCII - press CONTinue"
1200 !
1210 REAL Arb_20(1:20) ! Valid range: -1.0 to +1.0
1220 DATA -1,1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,1,1,1,1
1230 READ Arb_20(*) ! Read constants into array
1240 OUTPUT @Fgen;"data volatile,";Arb_20(*) ! Download 20 point waveform
1250 OUTPUT @Fgen;"func:user volatile" ! Select downloaded waveform
1260 OUTPUT @Fgen;"apply:user 10e3,1,0" ! Output waveform: 10kHz, 1Vpp
1270 Check_errors ! Routine checks for errors
1280 PAUSE
1290 !
1300 PRINT "Download 6 point Arbitrary waveform using Binary - press CONTinue"
1310 !
1320 INTEGER Arb_6(1:6) ! Valid range: -2047 to +2047
1330 DATA 2047,-2047,2047,2047,-2047,-2047
1340 READ Arb_6(*) ! Read constants into array
1350 OUTPUT @Fgen;"data:dac volatile,#212"; ! Send command; suppress CR/LF
1360 ! Note that the WAIT commands are not needed for GPIB - only for RS-232
1370 WAIT .1 ! Time to switch to binary mode
1380 OUTPUT @Bin;Arb_6(*); ! 12 bytes - no terminator
1390 WAIT .1 ! Time to switch to ASCII mode
1400 OUTPUT @Fgen;";:apply:user 5000,1,0" ! Terminator + APPLy
1410 Check_errors ! Routine checks for errors
1420 PAUSE
1430 !
Continued...