Using the Pattern Generator
Digital Pattern Generators are used to create digital signals to stimulate a circuit or device. This guide explains the use of WaveForms' Pattern Generator instrument. This instrument is also referred to as Patterns within WaveForms.
- A Digilent Test & Measurement Device with Digital Input/Output Channels:
- A Computer with WaveForms Software Installed
1. Opening the Pattern Generator
Plug in the Test & Measurement Device, then start WaveForms and make sure the device is connected.
If no device is connected to the host computer when WaveForms launches, the Device Manager will be launched. Make sure that the device is plugged in and turned on, at which point it will appear in the Device Manager's device list (1). Click on the device in the list to select it, then click the Select button (2) to close the Device Manager.
Note: “DEMO” devices are also listed, which allow the user to use WaveForms and create projects without a physical device.
Note: The Device Manager can be opened by clicking on the “Connected Device” button in the bottom right corner of the screen (3), or by selecting “Device Manager” from the “Settings” menu at the top of the screen.
Once the Welcome page loads, in the instrument panel at the left side of the window, click on the Patterns button to open the Pattern Generator instrument.
Once the Pattern Generator instrument opens, the window contains the output plot (1), the configuration panel (2) to left of the plot, and the control toolbar (3) at the top of the window.
2. Using the Pattern Generator
This section walks through setting up the Pattern Generator to generate a signal on a single channel.
When using the Pattern Generator with real hardware, note that the digital channels are not meant to be used as sources for large loads. Don't connect much more than a single LED and resistor directly to the channel. If larger loads need to be driven, the digital input/output channels can be used to trigger high current drivers such as MOSFETs, H-bridges, etc., but are not to be used as primary sources.
2.1 Software Setup
On the left panel, select the “Click to Add channels” button (1 in image at right) or the green plus button (). The menu that pops up allows signals to be added as individual lines, a bus, a standard protocol, or a custom protocol. To add individual lines, select “Signal” (2) and use CTRL and/or SHIFT to select multiple lines. For now, select DIO 0 and click “Ok”. Under the Type column, choose “Clock” from the drop-down menu and leave the other settings in their default state.
Return to WaveForms' Welcome page by clicking on its tab at the top left of the screen and select Logic. Alternatively, press the green plus button next to “Welcome” in the tab to add the instrument (3). On the left panel, select the “Click to Add channels” button or the green plus button (). From “Signals” select DIO 0 and click “Ok”. For a detailed tutorial about the Logic Analyzer instrument see Using the Logic Analyzer.
2.2 Generate Data
In the Pattern Generator instrument, click the Run button () in the control bar, and then click the Run button in the Logic Analyzer instrument (1 & 2, respectively, in the image to the right). The signal being generated by the Pattern Generator instrument will appear in the Logic Analyzer instrument.
Note: Variable Digital Supplies
On some devices, the Analog Discovery Pro (ADP3450) and Digital Discovery, several additional configuration options for the digital I/O are included in the Supplies instrument.
As seen in the screenshot to the right, the supply voltage (and digital output voltage) can be changed with the first of two sliders. The threshold voltage of the digital inputs is also changed with this slider, as can be seen in the second of the two sliders. This feature allows the user to change the I/O standard used for the digital I/Os. It should be noted that the supply voltage and threshold are shared by all digital I/Os.
Additionally, the default pull of each signal can be assigned on a per-channel basis. When pull-ups or pull-downs are enabled an undriven pin will be pulled up to the supply voltage or down to ground, respectively.
Note: This screenshot was taken with an ADP3450 connected. There are some minor differences with the user interface for the Digital Discovery.
For more information, check out Using the Power Supplies.
Note: Analog Discovery Pro (ADP3450/ADP3250) Sample Rate
The Analog Discovery Pro (ADP3450/ADP3250) features the ability to increase the system's sample rate, which affects many instruments, from the default of 100 MHz to 125 MHz. Click the dropdown below to learn how to use this feature.
- Modify the Analog Discovery Pro's (ADP3450/ADP3250) System Sample Rate
To access this setting, first open the Device Manager, which can be found in WaveForms' “Settings” menu.
The system sample rate itself can be changed by opening the Options dropdown while the Analog Discovery Pro device is selected in the list of devices. By changing the selection in the “Frequency” dropdown, the sample rate is changed. By increasing the system's sample rate in this way, the Waveform Generator, Oscilloscope, Logic Analyzer, Pattern Generator, and others, are made able to take in or put out samples at a rate of up to 125 MHz.
Note: Changing the system sample rate changes the set of sample rates that can be achieved by the Analog Discovery Pro's Digital I/O pins. Achievable rates with either selection are integer divisions of the system sample rate. For example, a 62.5 MS/s sample rate is achievable in the Logic Analyzer when the frequency is set to 125 MHz, but not when the frequency is 100 MHz.
Note: Using Multiple Instruments
The Pattern Generator instrument can be used with other WaveForms instruments. Using multiple instuments at the same time is helpful in a wide variety of situations. One example would be to use the Protocol Analyzer to configure a device under test, the Pattern Generator or Protocol Analyzer to stimulate the device, and capturing the result in the Logic Analyzer, all at the same time. More information on how instruments can be operated together can be found in the Using Cross Triggering guide.
It should be noted that while multiple instruments can use any Digital Input pin, and those pins can be used as Digital Outputs, no more than one instrument can control a Digital Output pin at a time. WaveForms accounts for this by disabling instruments using a shared output, or by displaying a message stating that a shared output is currently used by a different instrument.
3. Pattern Generator User Interface Overview
This section walks through the wide variety of controls and features available in the Pattern Generator instrument
3.1 Control Interface
The bar near the top contains several options for controlling the pattern generator.
The Run/Stop button starts and stops the pattern generator.
The Trigger drop-down allows for the selection of trigger sources from other instruments.
The Wait drop-down allows for the configuration of a delay after pressing Run (or the trigger event occurs). The value can be selected from the menu or typed in. If typing, be sure to enter a unit (ns, us, s, ms, ks, Ms) to avoid defaulting to the wrong order of magnitude.
The Run drop-down determines the period of time the pattern generator will generate a pattern for. It also automatically changes the horizontal time axis in the plot (unless manually overridden as shown in Section 3.2), making it so the Pattern Generator plot always shows a single period of the pattern (if continuous is selected) or the entire pattern that will be generated (if a time period is selected).
The Repeat drop-down is available when the Pattern Generator is set to run for a finite amount of time and will cause the instrument to generate the pattern the set number of times. In “continuous” mode this option is greyed out and set to “infinite”.
3.2 Pattern Signal Controls
Starting from the top left, the plus () and minus () buttons can be used to add or remove channels.
3.2.1 Types of Channels
When you add a channel to the Pattern Generator by click on the plus () symbol, you will notice that there are three options: Signal, Bus, and ROM Logic. Signal lines are just that, a one-bit signal, whereas BUS indicates that the I/O pin is a part of a data bus. ROM Logic allows you to change the status of an output based on the status of one or more inputs. More information about ROM Logic can be found in section 3.3 below.
The Show icon () selects which option columns are shown for each channel. The first four columns (Output, Idle, Type, and Parameter1) are available for every type of signal, while the last 2 columns are type-dependent.
The selections available in Parameter1 through Parameter3 menus will change depending on the selection in the Type.
Output switches between four output behaviors:
- PP (Push-Pull): possible output values are 0 and 1.
- OD (Open Drain): possible output values are 0 and Z. Bus values are computed by treating Z as 1. Requires a pull-up resistor
- OS (Open Source): possible output values are Z and 1. Bus values are computed by treating Z as 0. Requires a pull-down resistor
- TS (Tri-State): possible output values are 0, 1, and Z. Bus values containing Z will be displayed as a question mark.
Idle determines if the line is set the initial value, 0, 1, or Z when no signal is being driven through
Type determines the output types. Since the Parameter columns depend on Type, they will be described alongside the signal type:
(NOTE: Not all parameters are used for all signal types.)
- Constant: holds the signal as a constant, set by Parameter 1. Allowable states are determined by the Output column described above.
- Clock: generates a clock signal. The frequency is set by Parameter1, the duty cycle percentage is set by Parameter2, and the phase in degrees is set by Parameter3
- Pulse: generates a pulse signal. Parameter1 determines if the signal is active high or low, the number of data points to hold the signal low is set by Parameter2, and the number of data points to hold the signal high is set by Parameter3. By default, a data point lasts 10ns, so use the following formula to determine the pulse frequency:
- Random: generates a random pattern of outputs at a frequency determined by Parameter1.
- Custom: generates a custom pattern with frequency determined by Parameter1. The contents of the custom signal can be loaded from a file or set by hand by clicking the Parameter Editor button (see below)
Each signal can be further modified by clicking the Parameter Editor button (), located to the left of the Output column. Each Type selection will generate a different menu type.
Use the Properties button () to change the name or DIO pin of each signal line. It is located to the right of the signal name.
3.3 ROM Logic
When you add a channel to the Pattern Generator by clicking on the plus () symbol, you will see the screen as shown to the right. You can add or remove both input and output signals, or change the order. When you add a signal to either the input or output, you can give the signal a name and select which of the DIO pins will be used for that input or output. You can also adjust the frequency (adjustable from 100 mHz to 100 MHz of how often the logic is evaluated.
3.3.2 Truth Table
Once you have all of your inputs and outputs added to the table, you can click on the TRUTH TABLE button to create the logic or pattern you want WaveForms to execute. Note, an X in the Truth Table represents a “Don't Care” while 0 represents logic low or FALSE and a 1 represents logic high or TRUE.
3.4 Plot Controls
If the plot needs to be set to show a specific point in the pattern, this can be achieved using the drop-down menus directly below the control bar. The drop-down with the word “Auto” in it needs to be set to “Manual” to change the other two menus.
The Show drop-down will determine how much time per division to display.
The From drop-down will determine what the start point will be on the plot.
3.5 Menu Bar
The File menu, in the menu bar at the top of the Pattern Generator instrument, allows the user to save and load Pattern Generator instrument configurations and export an image of the created Patterns, or export the data points in .txt, .csv or .tdms formats. A new Pattern Generator instrument can be opened from here with the New Patterns menu point cloning the current patterns or opening a blank instrument.
The Control menu exposes the same functionality as the Run and Stop buttons, and lists hotkeys for the buttons.
The Window menu provides a fast way to switch to other tabs open in WaveForms.
For more guides on how to use the Digilent Test & Measurement Device, return to the device's Resource Center, linked from the Test and Measurement page of this wiki.
For more information on WaveForms visit the WaveForms Reference Manual.
For technical support, please visit the Test and Measurement section of the Digilent Forums.