1. Introduction to the Synchronization and Memory Core (SMC)
Advanced waveform triggering and sequencing is made possible on a variety of NI modular instruments by the NI Synchronization and Memory Core (SMC) architecture. As a result, this feature is available on arbitrary waveform generators, RF vector signal generators, and high-speed digital products. For more information on the SMC architecture, review National Instruments Synchronization and Memory Core - A Modern Architecture for Mixed-Signal Test.
Figure 1. Waveform Sequencing Implemented in the SMC Architecture
Modern arbitrary waveform generators implement deep onboard memory to store large waveforms. You can generate these waveforms in a sequential manner using what is commonly referred to as “linking and looping.” With this feature, you can create complex waveform sequences by generating waveforms in a predetermined or dynamic order.
Figure 2 illustrates three unique waveforms that you can store in memory on a signal generator.
Figure 2. Multiple Arbitrary Waveforms Stored in Memory
Once you have stored these waveforms in memory, you can link and loop them in a sequenced manner. Thus, you must also store the sequencing instructions for the waveforms in memory before the generation session begins. With NI signal generators, you can store multiple waveforms and multiple sequence instructions in the onboard memory. Figure 3 illustrates the possible memory usage of an NI signal generator.
Figure 3. NI signal generators store multiple waveforms in onboard memory.
Figure 3 shows that waveforms stored on a signal generator can occupy a significant amount of memory. For example, a waveform sampled at 100 MS/s for 1 second occupies 200 MB. Thus, it is important to effectively use the onboard memory of your signal generator. In fact, one advantage of using waveform linking and looping is that you can generate complex sequences while using minimal onboard memory.
2. Linking and Looping
Linking and looping options available on NI signal generators fall into two linking and looping modes - sequence mode and script mode. With sequence mode, you are able to configure the instrument to generate a predetermined series of waveforms with a sequence stored in the onboard memory. Script mode, on the other hand, is even more powerful because you can use it to create a dynamic waveform sequence in which the waveform generated is dependent on the state of a hardware or software trigger. In addition, script mode uses conditional statements such as “if/else” to implement branching waveform sequences. Finally, with both linking and looping modes, you can configure the signal generator to output one or several trigger signals with features such as the marker or marker event.
With sequencing mode, the waveform sequence must be configured so that each step contains information for three parameters - waveform name, loop count, and marker position. Figure 4 illustrates the parameters that are configured in a typical script.
Figure 4. Configured Parameters in a Waveform Sequence
The software programming interface for sequencing is created with the advanced arbitrary sequencing palette of the NI-FGEN driver in LabVIEW. With this driver, write the sequence instructions to the signal generator with the niFGEN Create Arbitrary Sequence VI shown in Figure 5.
Figure 5. Writing a Sequence to Onboard Memory
With this VI, the sequence instructions are written as two arrays - one containing the number of iterations for each waveform and the second containing the handle information for each waveform. In addition, you can create even more advanced sequences to output a marker event for each waveform. With this option enabled, you must configure a third array to designate the marker offset for each waveform.
3. Sequence Trigger Modes
You can generate waveforms that are configured in a sequence using a variety of different modes, depending on which trigger mechanism you select. While a trigger event can occur as a software event, it more commonly occurs in hardware on one of the many available trigger lines. With National Instruments signal generators, the trigger modes available for waveform sequencing are single trigger, continuous trigger, stepped trigger, and burst trigger. Each of these modes provides different output options when each waveform is generated. They are described below.
Single trigger mode is the simplest of all triggering modes because with this mode, a trigger is used only once during the generation period. Thus, after the trigger condition is met, the instrument must be rearmed to be active once again. In single trigger mode, a trigger is typically used as a start trigger to begin the generation of the waveform. As shown in Figure 6, the signal generator outputs the last sample of the last waveform while waiting to receive the start trigger. Once this trigger condition is met, the signal generator begins the generation of the waveform or sequence of waveforms.
Figure 6. Sequencing with a Single Start Trigger
As Figure 6 illustrates, the signal generator begins output on a rising edge of the start trigger. Note, however, that there is a slight delay between when the start trigger occurs and the channel 0 output begins. This delay, a function of the sampling rate and interpolation factors, is described in the signal generator specifications. In addition, notice that in this particular scenario, a sequence of two waveforms has been configured for generation. Once the last waveform in the sequence has been generated, the signal generator continues to drive the last sample value.
On the other hand, in continuous trigger mode, the entire sequence of waveform segments is continuously generated. Once the trigger is received, the signal generator begins generation of the signal with the first waveform in the sequence. In addition, the signal generator outputs each step in the sequence and then loops back to the first step upon completion of the sequence.
Figure 7. Sequencing with Continuous Trigger Mode
As Figure 7 illustrates, output begins shortly after the start trigger condition occurs. In addition, the signal generator continues to generate the sequence of waveforms until the generation session is stopped. Notice from Figure 6, that at time t2, the signal generator loops to the first waveform in the sequence.
In stepped trigger mode, a trigger is used to step through each waveform in a sequence list. When the generation session is started, the first waveform loops as many times as has been configured for that particular step. After the waveform has been looped for the appropriate number of iterations, the last sample of the waveform repeats continuously until the next trigger is received. When the next trigger is received, the second waveform generates for the configured number of iterations. This process repeats until the last of the configured waveforms has been generated. At this point, a trigger condition is required to start the generation sequence again (Figure 8).
Figure 8. Sequencing with Stepped Trigger Mode
As Figure 8 illustrates, the signal generator begins generating the first waveform at time t0, when the first trigger is received. In addition, it continues to loop through the generation of ‘waveform0’ until it reaches the number of configured loops (two in this case). In this particular scenario, you can observe that ‘waveform0’ has been configured to loop twice. As you can see in Figure 7, the signal generator continues to drive the last sample of ‘waveform0’ until time t1, when the next waveform is generated.
Burst trigger mode is similar to stepped trigger mode except that each waveform in the sequence repeats continuously between each received trigger. In this mode, the signal generator begins to generate a waveform when a trigger is received. In addition, it continues looping to generate that waveform until a subsequent trigger is received. Only then does it advance to the next waveform (see timing diagram in Figure 9).
Figure 9. Sequencing with Burst Trigger Mode
As Figure 9 illustrates, the first trigger is received at time ‘t0’ and causes the signal generator to generate the first step of the sequence. Notice that the signal generator continues to loop this waveform until it receives the next trigger. Thus, at ‘t1,’ when a second trigger is received, the signal generator proceeds to the next step in the sequence.
4. Scripting for Advanced Waveform Sequencing
While sequence mode enables a signal generator to output a series of waveforms upon receiving triggers, it does have its limitations. Fundamentally, sequence mode requires that each step is configured before signal generation has begun. To configure a dynamic script, where the output is conditional, you must use a more advanced form of sequencing called scripting.
With scripting, a signal generator can dynamically output a sequence of waveforms based on hardware or software events in the system. In addition, it is the most advanced waveform control feature because of its flexibility. You can use scripting not only to link and loop between multiple waveforms but also to generate a waveform conditional on an event that occurs in the device under test. In this section, explore basic script language elements using several example scripts.
Fundamentals of the Script Language
The basic idea of scripting is that a named waveform can be stored in memory on the signal generator and then called by a script that determines which waveform is generated at a given time. The script is also downloaded to the arbitrary waveform generator before signal generation.
In software, the scripting programming interface requires three basic functions. Each of these is shown in Figure 10.
Figure 10. Configuring a Script in LabVIEW
First, each waveform is downloaded to the arbitrary waveform generator (AWG) as a named waveform. It is absolutely necessary that a named waveform is written because the script identifies each waveform by name. Second, the script is written to the waveform. The script contains various commands that determine the order in which each waveform is generated. Finally, the generation is initiated and the AWG begins generating a waveform from the SMC output engine.
Introduction to Script Triggers
Script triggers enable the generation of even more complex scripts. With scripting, you can use a real-world signal to determine which waveform you should generate on the fly. This signal can come from a PXI trigger line on the backplane or a PFI (programmable function interface) trigger from the front panel connector.
You can configure the script trigger in software with the niFgen Configure Script Trigger VI. Using this function, you can configure either a level or edge trigger for a specific trigger line. After the function call in Figure 11, a script can use “scriptTrigger0” as a variable to determine the order in which various waveforms are generated.
Figure 11. Configuring a Script Trigger
In the scripting language, the script trigger is handled as a variable associated with a specific hardware condition. As illustrated in the Figure 11 example script, scriptTrigger0 must be evaluated as a true/false Boolean logic statement. This is shown in Figure 12.
Figure 12. Evaluating a Script Trigger
Because with script triggers you can use conditional statements within the scripting language, the signal generator can output a signal that is dependent on a signal from a real-world device under test. The next section examines some basic statements of the scripting language to provide an overview of scripting capabilities.
Basics of the Script Language
The script language contains several basic commands, which determine the order in which you can generate waveforms. This section lists the basic commands and walks through a couple of basic sequences that use them. The basic scripting command set includes commands such as the following:
Generate n – instructs the output engine to generate a sequence of waveforms ‘n’ times.
Repeat until – repeats a sequence until a particular condition has been met.
If/Else – a conditional statement where the script trigger operates as a Boolean variable.
Wait until – a delay statement that causes the output engine to wait until a condition has been met to resume signal generation.
Clear – erases any instances of triggers that might have occurred.
Repeat Until Command
With the “Repeat until” command, you can repeatedly generate a waveform until a trigger occurs. Figure 13 shows the set of commands required to implement a simple script that uses this command.
Figure 13. Example Script Using the “Repeat until” Command
Notice that “scriptTrigger0” is being used as the variable that determines which waveform should be generated. Use the flowchart in Figure 14 to visualize the script language.
Figure 14. Flowchart of Script Containing the “Repeat until” Command
In this specific script, the signal generator begins by generating “waveform0” first. Then it loops through generating “waveform1” and repeats this waveform until “scripttrigger0” evaluates to TRUE. Once this event occurs, the signal generator generates “waveform2” before finishing the sequence. Figure 15 shows the output signal resulting from this script.
Figure 15. Signal Generator Output with the “Repeat until” Script
As Figure 15 illustrates, the AWG continues to generate “waveform1” until “scripttrigger0” evaluates to TRUE.
Wait Until Command
With the “Wait until” command, you can configure a signal generator to halt generation of any waveform until a hardware condition occurs. Figure 16 shows an example script using “Wait until.” Again, notice that “scriptTrigger0” is used as the variable to determine when the AWG resumes waveform generation.
Figure 16. Example Script Using the “Wait until” Command
Notice the use of the “Clear” statement before the “Wait until” statement. The Clear statement is used to ignore any trigger conditions that may have occurred while “waveform0” was being generated. Figure 17 features a flowchart of this specific script.
Figure 17. Flowchart of Script Containing the “Wait until” Command
In this specific script, the AWG begins by generating “waveform0” first. After this, the signal generator outputs the last sample of “waveform0” until the trigger condition is met. Once the trigger condition occurs, the AWG resumes the script and generates “waveform1” and then “waveform2.” The physical output of the generator is shown in Figure 18.
Figure 18. Signal Generator Output with the “Wait until” Script
You can use the “If/else” command sequence to determine the order in which waveforms are generated depending on a hardware condition. In addition, when these commands are nested, you can use them to implement a truth table in which the waveform to generate depends on several trigger conditions. Figure 19 shows a simple script using the “If/else” command sequence.
Figure 19. Example Script Using the “If/else” Command
In addition, Figure 20 shows a flowchart representing the order in which particular waveforms are generated.
Figure 20. Flowchart of Script Containing the “If/else” Command
In this example, the AWG begins by generating “waveform0” first. Next, “scripttrigger0” is evaluated to determine which waveform is generated next. If “scripttrigger0” evaluates to FALSE, then “waveform1” is generated. If “scriptrigger0” evaluates to TRUE, then “waveform2” is generated. Figure 21 illustrates the physical output of the AWG, as shown as a function of time.
Figure 21. Signal Generator Output with the “If/else” Script
In Figure 21, when “scripttrigger0” evaluates to TRUE, “waveform2” is generated. Note that this example shows only a single conditional statement. With National Instruments AWGs, you can configure up to four script triggers. As a result, you can nest “If/else” statements to represent even more complicated logical statements.
5. Output Triggers and Events
So far, this document has primarily focused on the use of input triggers to control the output of signal generators. However, signal generators are able to generate output triggers to control the behavior of other instruments. The two types of output triggers are marker events and data marker events. For the first type, you can configure up to one (sequence mode) or four (script mode) trigger lines to change the state synchronous with a configured sample number. By contrast, the data marker event enables up to four bits of the analog waveform to be routed to up to four trigger lines. With this type of output trigger, the state of the trigger is embedded into the actual waveform.
With a marker event, you can configure up to four trigger lines so their states change synchronously with the generation of a specific sample. You can generate this digital pulse on PFI trigger lines on the front panel of a signal generator or on the PXI backplane.
Marker events are specified by giving an offset count (in number of samples) from the start of the waveform. In sequence mode, you configure one marker event for each step in the sequence. In script mode, you can configure up to four markers at different offsets of a particular waveform. As you can see in Figure 22, the trigger line associated with the marker becomes asserted on the same clock edge that generates the 20th sample. In addition, you can observe that in this particular case, the trigger line has been configured to be asserted for 40 periods of the sample clock.
Figure 22. Timing of Marker Event Output
Note that you can configure the behavior of the marker output in a number of ways with a property node. As Figure 22 illustrates, the marker event has been configured as a pulse for eight periods of the sample clock. You can specify this behavior with an niFgen property node (Figure 23).
Figure 23. Configuring a Marker Event with a Property Node
Figure 23 illustrates that it is possible to configure the output terminal, the output behavior, and the pulse width. While the marker in Figure 23 is configured as a pulse, you can also configure the output to toggle instead.
Marker events are particularly useful for scenarios when it is necessary to synchronize multiple instruments. In addition, with PXI signal generators, you can easily route marker event triggers to multiple modules such as digitizers, RF vector signal generators, or high-speed digital I/O hardware.
Data Marker Events
Using the data marker event, you can export up to four waveform data bits to a physical trigger line as a digital signal. For example, a typical signal generator uses a 16-bit DAC (digital-to-analog converter). Thus, when generating a signal, 16-bit samples are sent to the DAC every period of the sample rate frequency. In addition, you can route up to four bits of each sample to physical trigger lines. Thus, you can configure these four waveform bits as a digital waveform for synchronization with other hardware.
The digital level of a data marker event changes when a specific data bit toggles in the waveform data. If the waveform data bit toggles several times in a segment, the data marker level changes every time. When the data bit level is high, the data marker level is high. In addition, you can configure data bit markers to use inverse logic. A timing diagram of a signal using data bit markers is shown in Figure 24.
Figure 24. Bitwise Representation of a Waveform
As Figure 24 illustrates, each sample of a typical signal generator is composed of a 16-bit number. You can update the 16-bit number every sample clock of the signal generator. Figure 24 highlights the four least significant bits of each 16-bit sample. As described above, you can route each of these individual bits to a physical trigger line as a digital signal. The behavior of the digital trigger lines is illustrated in the timing diagram for each data bit trigger line in Figure 25.
Figure 25. Data Marker Event Timing Diagram
Figure 25 shows you can configure each data bit marker to be routed as an external trigger line. Notice that the bit value for each sample determines the state of the trigger line. In ‘DataBit3,’ notice that the bit is a ‘0’ for the first three clock periods and changes to a ‘1’ starting at time ‘t2.’ As a result, the digital state of ‘PXI_Trig 3’ remains low for the first three periods and goes high at time ‘t2.’
Using data marker events, you can achieve tighter synchronization between signal generators and other devices because you can time their operation in hardware. In addition, synchronization between multiple PXI instruments is even easier because no external connections are required between modules.
6. Summary and Applications
With the advanced waveform triggering and sequencing features of National Instruments signal generators, you can generate complex waveforms and achieve synchronization between multiple instruments. Moreover, the synchronized instruments are in the same physical PXI system. As a result, you can implement complex test signals that are tightly synchronized with multiple instruments. Figure 26 shows an example test setup that includes multiple instruments. Note that in a PXI system, a signal generator can implement marker event or data bit marker features to control the operation of other instruments.
Figure 26. Automated PXI Test System
As Figure 26 illustrates, a signal generator can provide a stimulus signal for the unit under test (UUT). Moreover, additional instruments can interface with the UUT synchronously using the stimulus from the master signal generator. For more information on designing ATE systems, download a collection of technical guides from the test system resource library.
Also, you can use stimulus signals from a UUT to determine the stimulus signal from the AWG. With scripting and script triggers, you can control the output of the signal based on real-world trigger events. Figure 27 shows a block diagram of a test scenario where a signal generator produces a series of different signals conditional on digital control signals coming from the UUT. With scripting, a signal generator can respond to these digital control signals on the fly, without stopping generation of its waveform.
Figure 27. Using Dynamic Sequencing
In Figure 27, the PFI0 and PFI1 have been configured as script triggers to receive inputs from the UUT. Note that signal generators are able to use up to four script triggers to control the signal output. If you need more than two control lines, you can use a PXI timing and synchronization module to route digital trigger signals to the signal generator.
Modern signal generators use the NI Synchronization and Memory Core (SMC) architecture to enable the generation of complex and accurate analog signals. As a result, signal generators can generate a large variety of signals and support a wide array of applications. To view a multimedia tutorial on the same topic, see Signal Generator Fundamentals: Scripting to Create Advanced Signals. For more information on features you can use to generate advanced waveform sequencing and triggering, see Signal Generator Fundamentals. For more information on the applications that typically use signal generators, see Signal Generator Applications main page.