User`s manual

Divide-by-N Frequency
Control
The FREQ2_REG program changes the signal frequency that is generated
using the Divide-by-N (
[SOURce:]FREQuency2) subsystem and the
reference oscillator from any of the available sources. The program
accesses the Sample/Hold and ROSC/N Control Register, and the ROSC/N
Divider Registers.
BASIC Program Example (FREQ2_REG)
1 !RE-STORE "FREQ2_REG"
2 !This program changes the output frequency generated with the
3 !divide-by-n frequency synthesis method by writing frequency
4 !data to the Sample/Hold and ROSC/N Control register, and to the
5 !ROSC/N Divider registers.
6 !
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
60 !the 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. Pass the
150 !reference oscillator frequency, the new output frequency, and
160 !the number of waveform points. (Note arbitrary waveforms: npts=1
170 !square waves: npts=4, ramp/triangle waves:
180 !npts=RAMP:POINts value.)
190 !
200 CALL Divide_by_n(4.E+7,2.5E+6,4)
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
492 Register-Based Programming Appendix C