# Multi-Channel Playback

 This tutorial is applicable to all HDAWG Instruments. The number of available signal channels depends on the model (HDAWG4 or HDAWG8).

## Goals and Requirements

The goal of this tutorial is to demonstrate multi-channel waveform playback with the AWG. In order to visualize the multi-channel signals, an oscilloscope with sufficient bandwidth and channel number is required.

## Preparation

Connect the cables as illustrated below. Make sure that the instrument is powered on and connected by Ethernet to your local area network (LAN) where the host computer resides. After starting LabOne, the default web browser opens with the LabOne graphical user interface.

Figure 1. Connections for the arbitrary waveform generator multi-channel playback tutorial

The tutorial can be started with the default instrument configuration (e.g. after a power cycle) and the default user interface settings (e.g. as is after pressing F5 in the browser).

## Channel Grouping

Using the channel grouping feature of the HDAWG, we can generate multi-channel signals in different configurations: using one sequence program for all 8 Wave outputs, using 2 sequence programs for Wave outputs 1-4 and 5-8 respectively, or using 4 sequence programs for Wave outputs 1&2, 3&4, etc. This is enabled by the multi-core architecture of the HDAWG, see AWG Architecture and Execution Timing. Channel grouping enables independent timing and triggering on different outputs and gives the flexibility to use 1 instrument for multiple experiments.

In the previous tutorial, we used the default channel grouping mode, which is 4x2 on 8-channel instruments, or 2x2 on 4-channel instruments, and we wrote sequence programs for dual-channel playback. Here we show an example of a 4-channel sequence program. To this end, we change the Channel Grouping setting in the AWG Sequencer tab to 2x4 (1x4, respectively) which changes the number of sequence editor side-tabs in that tab. We monitor the AWG signal using four channels of an external scope. The following tables summarize the settings to enable the HDAWG Wave outputs, to change the channel grouping, and to configure the external scope.

Table 1. Settings: enable the output
Tab Sub-tab Section # Label Setting / Value / State

Output

Wave Outputs

1-4

Enable

ON

Output

Sine Generators

1&2

Wave 1 Enable

OFF

Output

Sine Generators

1&2

Wave 2 Enable

OFF

Output

Sine Generators

3&4

Wave 3 Enable

OFF

Output

Sine Generators

3&4

Wave 4 Enable

OFF

AWG Sequencer

Control

Channel Grouping

2x4 or 1x4

Table 2. Settings: Configure the external scope
Scope Setting Value / State

Ch1-4 enable

ON

Ch1-4 range

0.2 V/div

Timebase

500 ns/div

Trigger source

Ch1

Trigger level

100 mV

Run / Stop

ON

The step from a dual-channel to a four-channel sequence is achieved by simple extension of the number of wave arguments of the playWave instruction to 4. The following sequence program generates a signal with 4 simultaneous pulses with different amplitudes. The setTrigger instructions can optionally be used to trigger the scope if the latter has an auxiliary trigger input as shown in Basic Waveform Playback . Upload and run this program. Figure 2 shows the signal generated with this program and measured with the scope.

wave w = gauss(8000, 4000, 1000);

while (true) {
setTrigger(1); setTrigger(0);
playWave(1.0*w, 0.5*w, -0.5*w, -1.0*w);
wait(10000);
}
Figure 2. Four-channel signal generated by the AWG and captured by the scope.

## Output Assignment

In addition to the single-channel, dual-, and quad-channel playback used up to now, there are more options for the channel assignment. The playWave instruction can be used with different combinations of arguments: with one wave type argument or with several, with a const type integer number specifying the Wave output or without. These different combinations of arguments allow the user to independently control the AWG core outputs (the digital signal sources inside the instrument) and the place where their signal is routed to (the Wave outputs on the front panel). See AWG Architecture and Execution Timing for an overview of the internal architecture and the terminology. Inside the Output Tab , the AWG core outputs are represented in the Waveform Generators section, whereas the signal outputs are represented in the Wave Outputs section.

The playWave instruction always assigns the first wave argument to the AWG core output 1, and the second one (if it’s provided) to the AWG core output 2. Each of the wave arguments can optionally be preceded by an integer argument of type const which specifies the associated signal output. E.g., playWave(2, w_gauss) will play the wave w_gauss on Wave output 2.

 A common pitfall is the instruction playWave(2, w_gauss) which generates a signal on Wave output 2, but uses the AWG core output 1. This means that the relevant Mode and Amplitude (FS) settings are on line 1 of the Waveform Generators section (Output tab), even though the signal is routed to Wave output 2.

It’s possible to route a single AWG core output to two Wave outputs at the same time by specifying two integer arguments per wave argument as in playWave(1, 2, w_gauss). This can for example be used to optimize waveform memory. Another option is to add up two AWG Outputs on one Wave output by using twice the same integer argument as in playWave(1, w_gauss, 1, w_drag). This is e.g. useful in combination with the Digital Modulation as it enables digital IQ modulation of an internal oscillator which gives full freedom in controlling the amplitude and phase of a carrier with the AWG. The following sequence program contains a number of examples for these configurations. Figure 3 shows the dual-channel signal generated with this program and measured with the scope.

wave w_gauss = 0.5*gauss(8000, 4000, 1000);
wave w_drag  = 0.5*drag(8000, 4000, 1000);

while (true) {
setTrigger(1);
// play wave on Signal Output 1 with AWG Output 1 (two equivalent commands):
playWave(w_gauss);
playWave(1, w_gauss);
// play wave on Signal Output 2 with AWG Output 1:
playWave(2, w_gauss);
// play identical Wave on Signal Output 1 and 2 generated with AWG Output 1:
playWave(1, 2,  w_gauss);
// play independent Waves on Signal Output 1 and 2 generated
// with AWG Output 1 and 2 (two equivalent commands):
playWave(w_gauss, w_drag);
playWave(1, w_gauss, 2, w_drag);
// add up two independent Waves on Signal Output 1
// generated with AWG Output 1 and 2:
playWave(1, w_gauss, 1, w_drag);

waitWave();
setTrigger(0);
wait(10000);
}
 Limitations to the concept of crossed assignments between AWG core outputs and Wave outputs come from the fact that one AWG core can only send signals to its associated Wave output pair (see AWG Architecture and Execution Timing)
Figure 3. Dual-channel signal generated by the AWG and captured by the scope.