User`s manual

400 A24_offset: !Subprogram which determines the base address for
410 !the AFG registers in A24 address space.
420 COM @Afg,@Afg1,Base_addr,Seq1_addr,Seq2_addr,Seq3_addr
430 CONTROL 16,25;2!access A16 space with READIO and WRITEIO
440 A16_addr=DVAL("D400",16) !AFG A16 base address
450 Offset=READIO(-16,A16_addr+6) !read AFG offset register
460 Base_addr=Offset*256 !shift offset for 24-bit address
470 SUBEND
480 !
490 SUB Build_ram
500 Build_ram: !This subprogram configures the AFG’s sequence base memory
510 !such that there are valid sequence base addresses in memory
520 !before the AFG is INITiated and waveforms are selected.
530 COM @Afg,@Afg1,Base_addr,Seq1_addr,Seq2_addr,Seq3_addr
540 CONTROL 16,25;3!access A24 space with READIO and WRITEIO
550 !
560 !Preserve Traffic register contents. Set bits 15-14 to 1 0 to set
570 !the Waveform Select register as the source which selects the output
580 !waveform sequence.
590 Traffic=BINAND(READIO(-16,Base_addr+IVAL("8",16)),IVAL("3FFF",16))
600 WRITEIO -16,Base_addr+IVAL("8",16);BINIOR(Traffic,IVAL("8000",16))
610 !
620 !Write the location of the sequence base address (waveform index)
630 !to the Waveform Select register. Write the base address of
640 !of the sequence in sequence memory to the Sequence Base register.
650 !
660 Wav_sel=BINAND(READIO(-16,Base_addr+IVAL("A",16)),IVAL("00FF",16))
670 WRITEIO -16,Base_addr+IVAL("A",16);BINIOR(Wav_sel,IVAL("0100",16))
680 WRITEIO -16,Base_addr+IVAL("20",16);Seq1_addr !sequence mem base addr
690 !
700 Wav_sel=BINAND(READIO(-16,Base_addr+IVAL("A",16)),IVAL("00FF",16))
710 WRITEIO -16,Base_addr+IVAL("A",16);BINIOR(Wav_sel,IVAL("0200",16))
720 WRITEIO -16,Base_addr+IVAL("20",16);Seq2_addr !sequence mem base addr
730 !
740 Wav_sel=BINAND(READIO(-16,Base_addr+IVAL("A",16)),IVAL("00FF",16))
750 WRITEIO -16,Base_addr+IVAL("A",16);BINIOR(Wav_sel,IVAL("0300",16))
760 WRITEIO -16,Base_addr+IVAL("20",16);Seq3_addr !sequence mem base addr
770 SUBEND
780 !
790 SUB Wave_change
800 Wave_change: !Once the AFG has been INITiated, this subprogram changes
810 !the output waveform sequence by writing the location of the
820 !sequence’s base address in sequence base memory to the
830 !Waveform Select register.
840 COM @Afg,@Afg1,Base_addr,Seq1_addr,Seq2_addr,Seq3_addr
850 INTEGER I
860 CONTROL 16,25;3 !access A24 space with READIO and WRITEIO
870 !
880 !Read the waveform select register and write back the value read, in
890 !order to clear the WFUSED bit in the Status register.
Continued on Next Page
Appendix C Register-Based Programming 501