User`s manual
Phase Control
Program
The PHAS_CHNG program demonstrates how to change the sine wave
signal phase while the waveform is currently at the AFG output.
BASIC Program Example (PHAS_CHNG)
1 !RE-STORE "PHAS_CHNG"
2 !This program changes the phase of the output signal by writing
3 !phase offset data to the phase modulation registers.
4 !
10 ASSIGN @Afg TO 1680
20 COM @Afg,Base_addr
30 !
40 !Call the subprograms which reset the AFG, which determine the base
50 !address of the AFG registers in A24 address space, and which set the
60 !output function.
70 CALL Rst
80 CALL A24_offset
90 CALL Output_function
100 !
110 DISP "Press ’Continue’ to change the signal phase (register writes)"
120 PAUSE
130 DISP ""
140 !Call the subprogram which changes the signal phase, and pass the new
150 !phase value.
160 !
170 CALL Phase_change(180)
180 END
190 !
200 SUB A24_offset
210 A24_offset: !Subprogram which determines the base address for
220 !the AFG registers in A24 address space.
230 COM @Afg,Base_addr
240 CONTROL 16,25;2 !access A16 space with READIO and WRITEIO
250 A16_addr=DVAL("D400",16) !AFG A16 base address
260 Offset=READIO(-16,A16_addr+6) !read AFG offset register
270 Base_addr=Offset*256 !shift offset for 24-bit address
280 SUBEND
290 !
300 SUB Output_function
310 Output_function: !Subprogram which uses SCPI commands to set DDS
320 !frequency synthesis, to set the output frequency/
330 !function/amplitude, to set up phase modulation, and
340 !to start the waveform.
350 COM @Afg,Base_addr
360 OUTPUT @Afg;"TRIG:STAR:SOUR INT1;"; !frequency generator
370 OUTPUT @Afg;":SOUR:FREQ1:FIX 60;"; !frequency
380 OUTPUT @Afg;":SOUR:PM:SOUR INT;"; !phase modulation source
390 OUTPUT @Afg;":SOUR:PM:STAT ON;"; !enable phase modulation
400 OUTPUT @Afg;":SOUR:FUNC:SHAP SIN;"; !function
Continued on Next Page
496 Register-Based Programming Appendix C