User`s manual
410 OUTPUT @Afg;":SOUR:VOLT:LEV:IMM:AMPL 5V" !amplitude
420 OUTPUT @Afg;"SOUR:PM:DEV 0DEG" !phase modulation angle
430 OUTPUT @Afg;"INIT:IMM" !wait_for_arm state
440 OUTPUT @Afg;"STAT:OPC:INIT OFF;*OPC?" !wait for INIT to complete
450 ENTER @Afg;Complete
460 SUBEND
470 !
480 SUB Phase_change(Phase)
490 Phase_change: !Subprogram which changes the phase of the output signal
500 !by writing phase data to the registers on the AFG.
510 COM @Afg,Base_addr
520 CONTROL 16,25;3!access A24 space with READIO and WRITEIO
530 !
540 !Calculate phase increment
550 Phase1=Phase MOD 360
560 IF Phase1<0 THEN Phase1=Phase1+360
570 Phase_data$=IVAL$(4096.*(16.*Phase1/360.)-65536.*(Phase1>=180.),16)
580 !
590 !Write the first byte of the phase increment to register B3.
600 !Write the second byte to register B1.
610 WRITEIO -16,Base_addr+IVAL("B3",16);IVAL(Phase_data$[1;2],16)
620 WRITEIO -16,Base_addr+IVAL("B1",16);IVAL(Phase_data$[3;2],16)
630 !
640 !Generate pulse which loads the new phase. Once the pulse is
650 !received, it takes 14 reference oscillator clock cycles before
660 !the new phase appears at the output.
670 WRITEIO -16,Base_addr+IVAL("8B",16);0
680 SUBEND
690 !
700 SUB Rst
710 Rst: !Subprogram which resets the E1445.
720 COM @Afg,Base_addr
730 OUTPUT @Afg;"*RST;*OPC?" !reset the AFG
740 ENTER @Afg;Complete
750 SUBEND
Comments • To simplify the program, SCPI commands are included to configure
the AFG, enable phase modulation, and start the waveform. Thus,
the only registers written to are the Phase Modulation and Phase
Load Strobe Registers. This program executes as intended when the
SCPI commands in subprogram Output_function are executed before
the registers are written to.
• Phase modulation is only available with standard function sine
waves. Standard function sine waves are only available with the
DDS (
[SOURce:]FREQuency[1]) subsystem.
Visual BASIC and
Visual C/C++ Program
Versions
The Visual BASIC example program, PHASCHNG.FRM, is in directory
“ VBPROG” and the Visual C example program, PHASCHNG.C, is in
directory “VCPROG” on the CD that came with your Agilent E1445A.
Appendix C Register-Based Programming 497