User`s manual
340 Output_function: !Subprogram which uses SCPI commands to set the
350 !42.94967296 MHz reference oscillator, to set DDS
360 !frequency synthesis, to set the output frequency/
370 !function/amplitude, and to start the waveform.
380 COM @Afg,Base_addr
390 OUTPUT @Afg;"SOUR:ROSC:SOUR INT1;"; !reference oscillator (42 MHz)
400 OUTPUT @Afg;":TRIG:STAR:SOUR INT1;"; !frequency1 generator
410 OUTPUT @Afg;":SOUR:FREQ1:FIX 1E3;"; !frequency
420 OUTPUT @Afg;":SOUR:FUNC:SHAP SIN;"; !function
430 OUTPUT @Afg;":SOUR:VOLT:LEV:IMM:AMPL 5V" !amplitude
440 OUTPUT @Afg;"INIT:IMM" !wait_for_arm state
450 OUTPUT @Afg;"STAT:OPC:INIT OFF;*OPC?" !wait for INIT to complete
460 ENTER @Afg;Complete
470 SUBEND
480 !
490 SUB Freq_change(Freq,Npts,Reference_osc,Range)
500 Freq_change: !Subprogram which changes the output frequency by writing
510 !the frequency to registers on the AFG.
520 COM @Afg,Base_addr
530 CONTROL 16,25;3!access A24 space with READIO and WRITEIO
540 !
550 !Calculate frequency value written to registers
560 IF Range>0 THEN
570 Phase$=DVAL$((Freq*Npts/Reference_osc/2)*4.294967296E+9,16)
580 ELSE
590 Phase$=DVAL$((Freq*Npts/Reference_osc)*4.294967296E+9,16)
600 END IF
610 !
620 !Write the first byte of the frequency value to register A7, the
630 !second byte to register A5, the third byte to register A3, and the
640 !fourth byte to register A1.
650 WRITEIO -16,Base_addr+IVAL("A7",16);IVAL(Phase$[1;2],16)
660 WRITEIO -16,Base_addr+IVAL("A5",16);IVAL(Phase$[3;2],16)
670 WRITEIO -16,Base_addr+IVAL("A3",16);IVAL(Phase$[5;2],16)
680 WRITEIO -16,Base_addr+IVAL("A1",16);IVAL(Phase$[7;2],16)
690 !
700 !Generate the pulse which loads the new frequency. Once the pulse is
710 !received, it takes 20 reference oscillator clock cycles before the
720 !new frequency appears at the output.
730 WRITEIO -16,Base_addr+IVAL("8D",16);0
740 SUBEND
750 !
760 SUB Rst
770 Rst: !Subprogram which resets the E1445.
780 COM @Afg,Base_addr
790 OUTPUT @Afg;"*RST;*OPC?" !reset the AFG
800 ENTER @Afg;Complete
810 SUBEND
490 Register-Based Programming Appendix C