Differences

This shows you the differences between two versions of the page.

Link to this comparison view

learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers [2019/08/22 17:17] – [Cross Triggering in WaveForms] Arthur Brownlearn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers [2022/10/04 11:38] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Using Cross Triggering ======+====== Using Cross Triggering (Page has Moved) ======
  
-==== Introduction ==== +<WRAP round important 660px> 
- +This guide has been replaced by [[test-and-measurement:guides:waveforms-cross-triggers]], and is slated to be removed from the Digilent Wiki. Please update all bookmarks and saved links to the new location. 
-When using Test and Measurement devices, understanding "triggering" - when and why data is acquired - is important. This guide introduces triggering as a concept, then explores several approaches to cross-triggering between multiple instruments and devices within the context of the WaveForms application. +</WRAP>
- +
----- +
-==== Prerequisites ==== +
- +
-  * One or more Digilent Test & Measurement Devices with Analog I/O and/or Digital I/O +
-    * **Note**: //Users without a device may still find this guide informative// +
-  * A Computer with [[reference:software:waveforms:waveforms-3:start|WaveForms]] Installed +
-  * Basic familiarity with WaveForms' //[[learn:instrumentation:tutorials:analog-discovery-studio-oscilloscope:start|Scope]]//, //[[learn:instrumentation:tutorials:analog-discovery-studio-waveform-generator:start|Wavegen]]//, and //[[learn:instrumentation:tutorials:analog-discovery-studio-digital-io|StaticIO]]// instruments +
- +
----- +
-==== 1. What is a Trigger? ==== +
- +
-{{page>learn:instrumentation:tutorials:analog-discovery-studio-using-external-triggers#what_is_a_trigger}}  +
- +
-==== 2. What is Cross Triggering? ==== +
-In the general sense, cross triggering describes systems where multiple instruments - often different devices - share trigger events. This can mean that either both instruments capture the signal containing the trigger event, or that when one of the instruments detects the trigger event, it generates a signal to trigger the other instrument. +
- +
-Since benchtop oscilloscopes traditionally only contain one instrument, cross triggering typically refers to sharing the same trigger between multiple devices. Because Digilent's Test and Measurement devices contain many different instruments, this guide covers both the multiple-device case and cross triggering between multiple virtual instruments within the same device. +
- +
----- +
-==== 3. Examples of Cross Triggering Systems ==== +
-=== 3.1 Cross Triggering between Instruments === +
-//This example demonstrates how using cross triggering makes it easier to change trigger sources across multiple instruments on a single device. A loopback circuit will be created that will connect the device's analog output to its analog inputs. We will experiment with several different trigger configurations, shared by both the device's //Scope// and //Wavegen// instruments, to do single-shot captures of an input waveform.// +
- +
-{{ learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:multi-instrument.png?800 |}} +
- +
----- +
-== 3.1.1 Hardware Setup == +
-<WRAP group><WRAP column half> +
-Connect the Digilent Test and Measurement device to the host computer. +
- +
-Connect the analog input channel 1 positive pin (1+, orange cable) to the waveform generator output channel 1 pin (W1, yellow cable). Then connect the analog input channel 1 negative pin (1-, orange and white cable) to ground (down arrow, black cable). Lastly, connect the external trigger 1 pin (TRIG 1, grey cable) to the digital input/output pin 0 (DIO 0, pink cable). +
- +
-The circuit achieved by these connections is a simple loopback, allowing the test and measurement device's waveform generator to provide a stimulus for its own oscilloscope, and to generate an external trigger with its digital I/O. See the block diagram to the right for a visual representation of how triggers and data flow through the system. +
-</WRAP><WRAP column half> +
-{{ learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:xtrig-multi-instrument.png?400 |}} +
-</WRAP></WRAP> +
----- +
-== 3.1.2 Software Setup == +
-<WRAP group><WRAP column half> +
-Launch WaveForms, then open the following instruments: +
-  - Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-waveform-generator:start|Wavegen]]// instrument, then make the following changes to its configuration: +
-    * Set the Channel //Synchronization// to //Independent// +
-    * Set the //Trigger// source to //Manual// +
-    * Set the //Wait// time to //none// +
-    * Set the //Run// time to //1 ms// +
-    * Set the //Repeat// count to //infinite// +
-    * Leave all other settings as their defaults +
-  - Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-oscilloscope:start|Scope]]// instrument, then make the following changes to its configuration: +
-    * Set the Trigger //Mode// to //Repeated// and //Normal// +
-    * Set the Trigger //Source// to //Wavegen 1// +
-    * Ensure the Time //Position// is //0 s// +
-    * Set the Time //Base// to //1 ms/div// +
-    * Ensure Channel 1's //Offset// is //0 V// +
-    * Ensure Channel 1's //Range// is //500 mV/div// +
-    * Disable Channel 2 by //unchecking// its box +
-  - Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-digital-io|StaticIO]]// instrument, then make the following change to its configuration: +
-    * Configure DIO 0 to be a button that outputs 0 when released, and 1 when pressed +
-</WRAP><WRAP column half> +
-{{ learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:multi-instrument-pre-capture.png?600 |}} +
-</WRAP></WRAP> +
- +
-**Note:** //In order to show each of the opened instruments on the screen at once, click on the Docking Windows button ({{learn:instrumentation:tutorials:analog-discovery-studio-voltmeter:symbol_docking.png?nolink}}) at the top right corner of the window. To return to the default tabbed view later, click on the Tabbed Windows button ({{learn:instrumentation:tutorials:analog-discovery-studio-voltmeter:symbol_tabbed.png?nolink}}) adjacent to the Docking Windows button.// +
- +
----- +
-== 3.1.3 Operating the Multi-Instrument Cross Trigger Example == +
-//Now that the workspace and hardware are set up, experimentation with the resulting system can begin.// +
- +
-Click the //Wavegen// and //Scope// instruments' **Run** () buttons. The instruments' states will go from **Ready** to **Armed**, meaning that each is now waiting for a trigger to occur. +
- +
-<WRAP group><WRAP column half> +
-Click the //Manual Trigger// button in the bottom left-hand corner of the WaveForms application (marked in red in the image to the right) to trigger the //Wavegen// instrument to output a signal once. The signal plays back so quickly that the //Wavegen's// state transition from **Armed** to **Running** back to **Armed** will probably not be seen. The //Scope's// state will go from **Armed** to **Trig'd** back to **Armed**, and the captured event will be displayed in the //Scope's// plot. +
- +
-Next, try modifying the //Wavegen// trigger's //Wait// time field. Any value will work. Click the Manual Trigger button again. The //Scope// take another capture. Despite the changes, the captured signal will be placed at the same point in the plot. Modifying the //Wavegen// trigger's wait time also affects the //Scope// trigger: both instruments wait for that amount of time after the Manual Trigger to capture/generate the signal. +
-</WRAP><WRAP column half> +
-{{ learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:multi-instrument-post-manual.png?600 |}} +
-</WRAP></WRAP> +
- +
-<WRAP group><WRAP column half> +
-Next, change the //Wavegen// trigger's //Source// field to //External 1//. In the StaticIO instrument, click the button corresponding to DIO 0 (marked in red in the image to the right). Observe that this button has the same behavior as the Manual Trigger. +
- +
-In conclusion, note that through each of these changes to the trigger configuration, the //Scope// trigger did not need to be reconfigured at all! +
- +
-Further information regarding the trigger configuration options available in each instrument can be found in their respective "Using the ..." guides (linked above), or through the [[reference:software:waveforms:waveforms-3:reference-manual|WaveForms Reference Manual]] +
-</WRAP><WRAP column half> +
-{{ learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:multi-instrument-post-external.png?600 |}} +
-</WRAP></WRAP> +
----- +
-=== 3.2 Cross Triggering between Devices === +
-//This example demonstrates a simple approach to comparing data captured using two devices at once. A circuit will be created between two Digilent Test and Measurement devices that share a single trigger. Each device's //Wavegen// instrument will stimulate the other device's //Scope// instrument, with each of these four instruments sharing a single trigger. This example demonstrates how multiple devices can be used to create a single system with an increased channel count.// +
- +
-{{ learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:multi-device-hardware.png?800 |}} +
- +
----- +
-== 3.2.1 Hardware Setup == +
- +
-<WRAP group><WRAP column half> +
-Connect two Digilent Test and Measurement devices to the computer. Two Analog Discovery 2s were used in creating this document, but any WaveForms compatible device with analog inputs and outputs will work. If the devices require external power, plug them in and turn them on. +
- +
-Make the following connections between the two devices' pins: +
-  * Connect each device's analog input channel one positive pin (1+, orange cable) to the other device's waveform generator channel one pin (W1, yellow cable). +
-  * Connect each device's analog input channel one negative pin (1-, orange and white cable) to a ground pin on either device (down arrow, black) +
-  * Connect a ground pin from each device to a ground pin from the other device (down arrow, black). +
-  * Connect each device's external trigger 1 pin (T1 or TRIG 1, grey cable) and digital output channel 1 pin (0 or DIO 0, pink cable) together, so that all four pins are connected to each other. +
- +
-See the block diagram to the right for a visual representation of these connections. +
- +
-**Note:** //The connections are symmetrical, so it does not matter which device is considered "#1" and which is considered "#2".// +
-</WRAP><WRAP column half> +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:xtrig-multi-device.png?600 |}} +
-</WRAP></WRAP> +
- +
----- +
-== 3.2.2 Software Setup == +
-1. Open two instances of WaveForms. +
- +
-2. Use each WaveForms instance's device manager to connect one device to each instance. +
- +
-**Note:** //In order to show each of the opened instruments on the screen at once, click on the Docking Windows button ({{learn:instrumentation:tutorials:analog-discovery-studio-voltmeter:symbol_docking.png?nolink}}) at the top right corner of the window. To return to the default tabbed view later, click on the Tabbed Windows button ({{learn:instrumentation:tutorials:analog-discovery-studio-voltmeter:symbol_tabbed.png?nolink}}) adjacent to the Docking Windows button.// +
- +
-<WRAP group><WRAP column half> +
-3. In one WaveForms instance, henceforth referred to as the "**primary** instance", open the following instruments, and configure them as described: +
-  * Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-oscilloscope:start|Scope]]// instrument and apply the following changes to its configuration: +
-    * Set the Time //Base// to //500 us/div// +
-    * Set the Trigger //Mode// to //Repeated// and //Normal// +
-    * Set the Trigger //Source// to //External 1// +
-    * Set the Trigger //Condition// //Rising// +
-    * Disable Channel 2 by //unchecking// its box +
-  * Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-waveform-generator:start|Wavegen]]// instrument and apply the following changes to its configuration: +
-    * Set the Channel //Synchronization// to //Independent// +
-    * Set Channel 1's //Trigger// Source to //External 1// +
-    * Set Channel 1's //Wait// Time to //none// +
-    * Set Channel 1's //Run// Time to //2ms// +
-    * Set Channel 1's Simple Wave //Frequency// to //1kHz// +
-    * Set Channel 1's Simple Wave //Type// to //Sine// +
-  * Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-digital-io|StaticIO]]// instrument and apply the following changes to its configuration: +
-    * Configure DIO 0 to be a button that outputs "0" when released and "1" when pressed. +
-  * Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-script-editor:start|Script]]// instrument. +
-</WRAP><WRAP column half> +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:primary-pre-capture.png?600 |}} +
-</WRAP></WRAP> +
- +
-<WRAP group><WRAP column half> +
-4. In the other WaveForms instance, henceforth referred to as the "**secondary** instance", open the following instruments, and configure them as described: +
-  * Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-oscilloscope:start|Scope]]// instrument and apply the following changes to its configuration: +
-    * Set the Time //Base// to //500 us/div// +
-    * Set the Trigger //Mode// to //Repeated// and //Normal// +
-    * Set the Trigger //Source// to //External 1// +
-    * Set the Trigger //Condition// to //Rising// +
-    * Disable Channel 2 by //unchecking// its box +
-  * Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-waveform-generator:start|Wavegen]]// instrument and apply the following changes to its configuration: +
-    * Set the Channel //Synchronization// to //Independent// +
-    * Set Channel 1's Trigger to //External 1// +
-    * Set Channel 1 //Wait// Time to //none// +
-    * Set Channel 1 //Run// Time to //2 ms// +
-    * Set Channel 1 Simple Wave //Frequency// to //1 kHz// +
-    * Set Channel 1 Simple Wave //Type// to //Square// +
-  * Open a new //[[learn:instrumentation:tutorials:analog-discovery-studio-script-editor:start|Script]]// instrument. +
-</WRAP><WRAP column half> +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:secondary-pre-capture.png?600 |}} +
-</WRAP></WRAP> +
-<WRAP group><WRAP column half> +
-5. Copy the code to the right into the **primary** instance's //Script// instrument. +
-</WRAP><WRAP column half> +
-<code>{ +
-  // Create a reference channel to contain the imported acquisition +
-  var r = Scope.Ref1.Range.value +
-  var o = Scope.Ref1.Offset.value +
-  Scope.Ref1.Clone(Scope.Channel1)  +
-  Scope.Ref1.Range.value = r +
-  Scope.Ref1.Offset.value = o +
-  // Open the file exported by the secondary instance +
-  var f = File("1.bin") +
-  // Wait for the other instance to finish saving data +
-  for(var i = 0; i < 1000 && !f.exist(); i++); +
-  // Read data from the file and save it into the reference channel +
-  var rg = f.readDouble() +
-  f.deleteFile() +
-  Scope.Ref1.data = rg +
-}</code> +
-</WRAP></WRAP> +
-<WRAP group><WRAP column half> +
-6. Copy the code to the right into the **secondary** instance's //Script// instrument. +
-</WRAP><WRAP column half> +
-<code>{ +
-  // Create a binary file and write the channel 1 acquisition into it +
-  var f = File("1.bin") +
-  f.writeDouble(Scope.Channel1.alldata) +
-}</code> +
-</WRAP></WRAP> +
- +
----- +
-== 3.2.3 Operating the Multi-Device Cross Trigger Example == +
- +
-//Now that the workspaces and hardware are set up, experimentation with the resulting system can begin.// +
- +
-This multi-device system connects the //Wavegen// and //Scope// instruments of the two devices together, so that all are triggered by the same external trigger, sourced from the **primary** device's digital input/output channel 1, which is driven by the //StaticIO// button. +
- +
----- +
-<WRAP group><WRAP column half> +
-To capture data, first, click the **Run** button in each //Scope// and //Wavegen// instrument. Then, click the **primary** instance's //StaticIO// DIO 1 button to trigger all four instruments. Each device will play its wave for two milliseconds, which will then be captured by the other device's //Scope//. The results will look like the images to the right. +
-</WRAP><WRAP column half> +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:primary-post-capture.png?400 |}} +
- +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:secondary-post-capture.png?400 |}} +
-</WRAP></WRAP> +
----- +
-<WRAP group><WRAP column half> +
-To view data captured by each device in the same plot, click the **Run** button in the **secondary** instance's //Script// instrument to export its captured data to a file. Then, click the Run button in the **primary** instance's //Script// instrument to import that data into its //Scope// as a Reference Channel. The result will look like the image to the right. +
-</WRAP><WRAP column half> +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-using-cross-triggers:primary-post-import.png?nolink&600 |}} +
-</WRAP></WRAP> +
----- +
- +
-Using multi-device systems like this allows a user to greatly extend the number of analog signals that can be captured at once. For the Analog Discovery 2, each additional device adds another two analog input and output channels to the overall system, and digital I/O could easily be added as well. While the two captures are not perfectly aligned (each device runs on its own oscillator), the overall system may be good enough for use in some applications. +
- +
-The WaveForms application was not designed to support more than one device at a time. However, WaveForms SDK is available for users that want to develop their own applications, and can readily support a large number of devices. +
- +
----- +
-==== Next Steps ==== +
- +
-Especially when using multiple devices, the calibration (or lack thereof) of the devices may affect the ability to compare acquired data. For more information on calibrating your Test and Measurement device, see the [[learn:instrumentation:tutorials:analog-discovery-calibration:start|]] guide. +
- +
-For more guides on how to use the Digilent Test & Measurement Device, return to the device's Resource Center, linked from [[reference:instrumentation:start|Instrumentation]] page of this wiki. +
- +
-For more information on WaveForms, visit the [[reference:software:waveforms:waveforms-3:reference-manual|WaveForms Reference Manual]].  +
- +
-For technical support, please visit the [[https://forum.digilentinc.com/forum/8-scopes-instruments/|Scopes and Instruments]] section of the Digilent Forums. +
- +
-{{tag>analog-discovery-studio tutorial}}+
  
 +{{tag>to-be-removed}}