User`s manual

Frequency Control
Programs
The following programs demonstrate how to change the signal frequency
while the waveform is currently at the AFG output.
DDS Frequency Control The FREQ_REG program changes the signal frequency that is generated
using the DDS (
[SOURce:]FREQ[1]) subsystem and the reference oscillator
from any of the available sources. The program accesses the Phase
Increment and Frequency Load Strobe Registers.
BASIC Program Example (FREQ1_REG)
1 !RE-STORE "FREQ1_REG"
2 !This program changes the output frequency generated by the direct-
3 !digital-synthesis (DDS) method by writing frequency-value data to
4 !the AFG’s Phase Increment registers.
5 !
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 frequency (register writes)"
120 PAUSE
130 DISP ""
140 !Call the subprogram which changes the output frequency, and pass the
150 !frequency, the number of waveform points, the reference oscillator
160 !frequency, and the frequency range (SOUR:FREQ1:RANGe command).
170 !(Note: sine waves and arb waves: npts=1, square waves: npts=4,
180 !ramp/triangle waves: npts=RAMP:POINts value.)
190 !
200 CALL Freq_change(2000.,1,4.294967296E+7,0)
210 END
220 !
230 SUB A24_offset
240 A24_offset: !Subprogram which determines the base address for
250 !the AFG registers in A24 address space.
260 COM @Afg,Base_addr
270 CONTROL 16,25;2!access A16 space with READIO and WRITEIO
280 A16_addr=DVAL("D400",16) !AFG A16 base address
290 Offset=READIO(-16,A16_addr+6) !read AFG offset register
300 Base_addr=Offset*256 !shift offset for 24-bit address
310 SUBEND
320 !
330 SUB Output_function
Continued on Next Page
Appendix C Register-Based Programming 489