======Using the Pattern Generator ====== ~~TechArticle~~ {{test-and-measurement/analog-discovery-pro-2230/patterns-screenshot.png?nolink|}} ===== Introduction ===== 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. ---- ===== Prerequisites ===== * A Digilent Test & Measurement Device with Digital Input/Output Channels: * [[test-and-measurement:analog-discovery-3:start|Analog Discovery 3]] * [[test-and-measurement:analog-discovery-pro-3x50:start|Analog Discovery Pro (ADP3450/ADP3250)]] * [[test-and-measurement:analog-discovery-pro-2230:start|Analog Discovery Pro (ADP2230)]] * [[test-and-measurement:analog-discovery-studio:start|Analog Discovery Studio]] * [[test-and-measurement:digital-discovery:start|Digital Discovery]] * [[test-and-measurement:analog-discovery-2:start|Analog Discovery 2]] * [[test-and-measurement:analog-discovery:start|Analog Discovery (Legacy)]] * A Computer with WaveForms Software Installed ---- ===== Guide ===== ==== 1. Opening the Pattern Generator==== == 1.1 == 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.// {{ reference:test-and-measurement:guides:waveforms-oscilloscope-device-manager.png?600 |}} ---- == 1.2 == 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. {{ :learn:instrumentation:tutorials:waveforms-instrument-panel:waveforms-instrument-panel-patterns.png?nolink&600 |}} ---- === 1.3 === 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. {{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:pattern_analyzer.png?600}} ---- ==== 2. Using the Pattern Generator==== //This section walks through setting up the //Pattern Generator// to generate a signal on a single channel.// ==Important== 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 ({{:learn:instrumentation:tutorials:analog-discovery-studio-logic-analyzer:symbol_plus.png?nolink}}). 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 ({{:learn:instrumentation:tutorials:analog-discovery-studio-logic-analyzer:symbol_plus.png?nolink}}). From "Signals" select DIO 0 and click "Ok". For a detailed tutorial about the //Logic Analyzer// instrument see [[test-and-measurement:guides:waveforms-logic-analyzer]]. {{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:2.1b.png?600}} === 2.2 Generate Data === In the //Pattern Generator// instrument, click the Run button ({{:learn:instrumentation:tutorials:waveforms-buttons:waveforms-run.png?nolink}}) 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. {{learn:instrumentation:tutorials:analog-discovery-studio-logic-analyzer:2.2.png?600}} ---- ==== Note: Variable Digital Supplies ==== {{section>test-and-measurement:guides:waveforms-digital-supplies&noheader}} ==== Note: Analog Discovery Pro (ADP3450/ADP3250) Sample Rate ==== {{section>test-and-measurement:analog-discovery-pro-3x50:change-max-sample-rate&noheader}} ==== 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 [[test-and-measurement:guides:waveforms-cross-triggers]] 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. /* For more information, please see the **Cross-Triggering Guide** FIXME link.*/ 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 [[#pattern_signal_controls|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". {{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:control_bar.png?600}} === 3.2 Pattern Signal Controls === Starting from the top left, the plus ({{:learn:instrumentation:tutorials:analog-discovery-studio-logic-analyzer:symbol_plus.png?nolink}}) and minus ({{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:minus.png?nolink}}) 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 ({{:learn:instrumentation:tutorials:analog-discovery-studio-logic-analyzer:symbol_plus.png?nolink}}) 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 ({{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:show.png?nolink}}) 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**. {{reference:test-and-measurement:guides:romlogic.png?200|}} **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 10//ns//, so use the following formula to determine the pulse frequency: {{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:equation.png?nolink}} * //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 ({{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:params.png?nolink}}), located to the left of the **Output** column. Each **Type** selection will generate a different menu type. Use the Properties button ({{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:properties.png?nolink}}) to change the name or DIO pin of each signal line. It is located to the right of the signal name. {{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:pattern_signals.png?600}} === 3.3 ROM Logic === === 3.3.1 Parameters === When you add a channel to the Pattern Generator by clicking on the plus ({{:learn:instrumentation:tutorials:analog-discovery-studio-logic-analyzer:symbol_plus.png?nolink}}) 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. {{reference:test-and-measurement:guides:romlogic2.png?400|}} === 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. {{:test-and-measurement:guides:truthtable.png?400|}} === 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. {{learn:instrumentation:tutorials:analog-discovery-studio-pattern-generator:plot_bar.png?600}} === 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. ==== Next Steps ==== 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:start]] page of this wiki. For more information on WaveForms visit the [[software:waveforms:waveforms-3:reference-manual|WaveForms Reference Manual]]. For technical support, please visit the [[https://forum.digilent.com/forum/8-test-and-measurement/|Test and Measurement]] section of the Digilent Forums.