Waveform Generator

Description

Page 5 of the upper I/O map provides control for the D/A waveform generator. The D/A waveform generator uses an in-FPGA memory block of 1024 words to store D/A codes. The FPGA parses through this memory at a user-programmable speed (or through manual/external trigger) while sending codes to the D/A converter. The generator automatically stops if enhanced features are disabled.

The generator works on frames. A new frame is triggered from a programmable source (manual, counters, external, etc.). For each frame, the FPGA sends a programmable (1, 2 or 4) number of D/A codes from the generator’s memory bank to the DAC. This transfer is done in latched mode and the DAC is updated after all codes in a frame are sent. The generator continues this process, incrementing through the memory until it reaches the end of the buffer or reaches a programmable depth, where it wraps back to the beginning of the buffer and continues operation. The generator can be paused, resumed or reset to the beginning of the memory bank at any time.

With the use of the memory block the D/A waveform generator can output consistent waveforms at a maximum frequency of 100KHz. There are four different input sources available for the D/A waveform generator.

  • manual software trigger

  • counter 0 output

  • counters 1+2 output

  • external trigger

  • The memory block also allows a programmable depth which when hit, will wrap and return to the beginning. The threshold ranges from 64 to 1024 and is programmable in multiples of 64.

    Programming the D/A Waveform Generator

    This section details how to program the D/A waveform generator through direct I/O without using the Diamond Systems driver software. Please, note that the D/A waveform generator is an enhanced feature and enhanced features must be enabled to access the feature.

    The following steps, described in the following subsections, are used to programming the D/A waveform generator.

    1. Enable enhanced features

    2. Reset D/A waveform pointer

    3. Latch D/A value

    4. Store D/A values into buffer

    5. Setup D/A wave form settings

    6. Start D/A waveform generator

    Enable Enhanced Features

    Enable enhanced features as described in the Enabling Enhanced Features section of this document.

    Reset D/A Waveform Pointer

    Reset the D/A waveform pointer by accessing Page 5, Base+15, bit 2. Writing a 1 to this bit, causing the pointer to start at the beginning, address 0.

    Latch D/A Value

    The procedure for latching a D/A value is nearly identical to the formula in the Generating An Analog Output section of this document; the only difference is that instead of setting DASIM to 1, set DAGEN to 1. The D/A value code must be computed for the desired voltage. From the computed value, obtain the LSB and MSB and add the channel number and set DAGEN bit. Write final the LSB and MSB to registers Base+4 and Base+5. By setting the DAGEN bit to 1, the D/A value written will be latched to internal memory instead of the DAC chip.

    Store D/A Values into Buffer

    Once the D/A code is latched, it must be stored in the waveform buffer. Set Page to 5 and write the buffer address (0 to 1023) for the latched D/A value into Base+12 and Base+13. When Base+13 is written, the latched D/A value at Base+4 and Base+5 is loaded and stored into the waveform memory. Both the D/A output code and D/A output channel are stored.

    Setup D/A Wave Form Settings

    D/A waveform settings include input source, number of code per frame and threshold. Each can be individually set, in any combination.

    There are four different input sources to choose from.

  • manual/software trigger

  • counter 0 output

  • counters 1+2 output

  • external trigger

  • Manual trigger should be used when the rate is slow or inconsistent and needs be controlled in software. Counter 0 output should be used when a consistent rate is desired and counter 1/2 is used for A/D interrupts. Counter 1+2 should be used when a consistent rate is desired and counter 0 is used for other interrupt functions, or if you want to synchronize the waveform generator to A/D interrupt functionality. External trigger should be used when an external signal is desired to generate D/A waveform. Input source is set on Page 5, Base+14, bits 0 and 1.

    The number of the code per frame determines the number of buffer values that will be output per frame. Each code is determined by the value set at its address.

    For example, if the codes per frame option is set at 2, the first frame will output the codes at address 0 and 1, then 2 and 3, then 4 and 5 and so on. The number of the code per frame is set on Page 5, Base+14, bits 2 and 3.

    Threshold determines the number of the code to output before the pointer starts over. The threshold must be set in multiples of 64 up to 1024. When the threshold is reached, the pointer wraps to the beginning. Threshold is set on Page 5, Base+14, bits 4, 5, and 6.

    Start D/A Waveform Generator

    Initialize D/A waveform output by writing 1 to Page 5, Base + 15, bit 0. The generator continues to output the periodic waveform until you disable it.