**NI Lock-In Amplifier**

**Start-Up Kit**

**User Manual**

[Introduction 4](#introduction)

[How it works 4](#how-it-works)

[Front Panel 6](#front-panel)

[1. Reference Section 6](#reference-section)

[Error Indicator 7](#error-indicator)

[Type Control 7](#type-control)

[PLL Filter TC (s) Control and Indicator
7](#pll-filter-tc-s-control-and-indicator)

[Phase Shift Control 8](#phase-shift-control)

[Phase Autozero Control 8](#phase-autozero-control)

[Order Multiplier Control 8](#order-multiplier-control)

[Switch Signal/Reference Control 8](#switch-signalreference-control)

[2. Filter Section 8](#filter-section)

[Type Control 8](#type-control-1)

[TC (s) Control 9](#tc-s-control)

[Filter Roll-off Control 10](#filter-roll-off-control)

[Settle Time(s) Indicator 10](#settle-times-indicator)

[Timer(s) Indicator 10](#timers-indicator)

[Reset Button 10](#reset-button)

[APPLY Button Control 10](#apply-button-control)

[3. Signal Generator Section 10](#signal-generator-section)

[Signal Generator Selector 10](#signal-generator-selector)

[Ref Amp Control 10](#ref-amp-control)

[Sig Amp Control 10](#sig-amp-control)

[Frequency Control 11](#frequency-control)

[Ref Shape Control 11](#ref-shape-control)

[Reference Noise (V) Control 11](#reference-noise-v-control)

[4. Graphical Display Section 11](#graphical-display-section)

[Graph Indicator 11](#graph-indicator)

[Plot Control 11](#plot-control)

[Backlog Bar 11](#backlog-bar)

[DEMO Control 11](#demo-control)

[START Control 12](#start-control)

[5. Digital Display Section 12](#digital-display-section)

[Display Selection Control 12](#display-selection-control)

[RESET MAX/MIN Button 12](#reset-maxmin-button)

[STOP Button 12](#stop-button)

[SI Notation Switches 12](#si-notation-switches)

[Display Mode Control 12](#display-mode-control)

[Digital Display Controls 12](#digital-display-controls)

[Display Enable Control 13](#display-enable-control)

[6. Configuration Section 13](#configuration-section)

[AI Configuration Control 13](#ai-configuration-control)

[Greeting Message Control 14](#greeting-message-control)

[Lock-in Engine VI 15](#lock-in-engine-vi)

[LockinCheckLicense.vi 15](#lockinchecklicense.vi)

[Description 15](#description)

[Controls 15](#controls)

[Indicators 15](#indicators)

[LockinPLL.vi 15](#lockinpll.vi)

[Description 15](#description-1)

[Controls 16](#controls-1)

[Indicators 17](#indicators-1)

[LockinDemodulatorSettings.vi 18](#lockindemodulatorsettings.vi)

[Description 18](#description-2)

[Controls 18](#controls-2)

[Indicators 18](#indicators-2)

[LockinDemodulator.vi 19](#lockindemodulator.vi)

[Description 19](#description-3)

[Controls 19](#controls-3)

[Indicators 20](#indicators-3)

# Introduction

National Instruments new Lock-In Amplifier Start-Up Kit provides virtual
instrumentation for the precise measurement of AC signals that are
partially or completely buried in noise. The start-up kit extends the
power of LabVIEW to measure signals that you could not measure before,
such as very small signals buried 100 dB deep in noise. An example of
this includes extracting a 50 mV sine wave from a white noise signal
with 5 V amplitude.

## How it works

A lock-in amplifier is intended for precise measurement of AC signals.
The noise is removed by performing a Fourier transform on the input
signal at the frequency and phase carried by the reference signal. A
lock-in amplifier acts as a narrow band-pass filter (as narrow as 1 mHz)
around the reference signal frequency.

Simplified Lock-In Block Diagram

The reference signal is fed into an internal reference synthesizer that
extracts frequency and phase information from the reference signal and
generates a pure sine wave. That sine wave is then mixed with the
amplified signal (amplification is optional). For each frequency
component in the input signal, the mixer generates two output
components: one with the frequency equal to the difference between the
frequencies of the internal reference and the signal component (ω~R~ -
ω~S~) and one equal to the sum of the two frequencies (ω~R~ + ω~S~). For
the component of the input signal with the frequency equal to that of
the internal reference (ω~S~ = ω~R~), the first mixer component will
have frequency equal to 0 (a DC signal) and the second mixer component
will have frequency equal to twice the reference frequency (2ω~R~). A
low-pass filter that follows the mixer should ideally reject everything
but the DC component, which is proportional to the amplitude of the
signal component at the ω~R~ and the cosine of its phase relative to the
phase of the internal reference (A•cos(θ)). This quantity is referred to
as "X." If the same process, mixing and filtering, is applied using a
pure cosine wave at ω~R~, quantity "Y" will be generated. Y is
proportional to the amplitude of the signal component times the sine of
the phase shift (A•sin(θ)). From these two quantities, the amplitude (A)
and relative phase (R) of the input signal can be determined.

In practice, however, the low-pass filter will reject only frequencies
that are outside of its cutoff frequency range. Consequently, all noise
in the range (ω~R~ ± filter cut-off frequency) will pass through the
filter and adversely affect the measurement. That is why the
characteristics of the output filter are of crucial importance to making
fast *and* precise measurements.

When speaking about lock-in amplifiers, filter bandwidth is expressed in
seconds (time-constant or TC) instead of in frequency. This is because
TC is directly proportional to the filter settling time. If we define
the cutoff frequency as the frequency at which the signal is attenuated
3 dB (multiplied by the filter order for higher order filters), the IIR
filter used in the National Instruments lock-in engine has a cut-off
frequency equal to 1/(2π TC) Hz. The TC is the filter time constant
expressed in seconds. For the FIR filter that frequency is approximately
0.35/TC Hz.

# Front Panel

The Lock-In DEMO VI front panel consists of the following sections:

1)  Reference

2)  Filter

3)  Signal Generator

4)  Graphical Display

5)  Digital Display

6)  Configuration

What follows is a brief description of controls and indicators in each
section.

![](media/image1.png){width="6.495833333333334in"
height="4.903472222222222in"}

**Lock-In DEMO VI Front Panel**

## 1. Reference Section

Controls and indicators in this section affect how the external
reference is converted into internal reference waves mixed with the
input signal to extract the amplitude and phase of the desired frequency
component.

### *Error Indicator*

The unnamed LED located immediately to the right of the "Reference" text
will turn RED if an error has been detected while extracting frequency
and phase information. Otherwise it is green.

### *Type Control*

This control is used to select the frequency range and shape of the
reference signal. The information is used internally to determine the
optimal algorithm for extraction of the reference signal frequency and
phase. *Auto* signifies that the lock-in will detect any frequency
within its range.

The main difference between *Auto \[Sine\]* and *Auto \[Sine-Sync\]* is
how often the reference frequency is updated. If the *Auto \[Sine\]*
option is selected, the reference frequency is updated for each block of
data retrieved from the device analog input buffer. For example, if the
sampling rate is 200 kHz and the data block size is set to 20,000 (see
Configuration Section), the reference frequency will be updated 10 times
each second. If the *Auto \[Sine-Sync\]* is selected, the reference
frequency will be updated only for data blocks in which a threshold
crossing with positive slope has been detected.

If the reference frequency is 1 Hz, its value is updated once every
second even though 10 data blocks have been processed during the same
time interval.

Please note that if the number of data blocks processed each second is
smaller than the reference frequency, the processing rate determines the
update rate. For instance, if the sampling rate is 200 kHz, the data
block size is 400,000 points, and the reference frequency is 1 Hz,
updates occur only once every two seconds. Consequently, the two options
become identical when the reference frequency is large enough for each
data block to contain at least one full cycle. The main reason for the
synchronous option is to reduce the processor load, which may allow for
the increase in the acquisition rate or a reduction in the data block
size.

The frequency of the square waves is always updated in a synchronous
fashion since the exact frequency can be determined only once a positive
slope edge has been detected.

The VI will automatically handle reference signals that are not
symmetric around the zero as long as the value of the offset does not
change significantly throughout the measurement. A TTL signal is an
example of such a signal.

### *PLL Filter TC (s) Control and Indicator*

This Control/Indicator determines the amount of data used to extract the
reference signal frequency and phase. For all sinusoidal references, and
square references with frequencies larger than 5 Hz, at least three
cycles of the signal are required for information extraction. For all
other square references, only one cycle is required. This option can be
very useful when the reference signal is noisy.

The lock-in engine algorithm will automatically choose the time closest
to the time entered into the control that is displayed in the blue
colored indicator. For example, if TC of 0 is requested, only three
cycles will be used to extract the necessary information, regardless of
the reference frequency. Please note that as TC increases, more
computation is required and buffer overflows may occur on slower
computers.

### *Phase Shift Control*

This control can be used to insert phase lag into the internal reference
signals. Phase lag may be necessary to maximize the X or Y components
when the signal arriving at the lock-in is phase shifted with respect to
the reference signal. One can either use the dial or type the
phase-shift directly into the dial's digital display.

The shift should be entered in degrees.

### *Phase Autozero Control*

When autozero is turned on, the value of the current phase shift is
written into the *Phase Shift* control so that the X component is
maximized. The control will be automatically deselected once the value
has been written.

### *Order Multiplier Control*

This multiplier can be used to modify the reference frequency that the
lock-in is locking onto. By entering integer values 2, 3, 4, and others,
one can lock onto the 2^nd^, 3^rd^, 4^th^, etc., harmonic of the
original reference frequency.

There is no protection from entering a multiple that will cause the
reference frequency to go above half of the sampling frequency, so be
careful when selecting values.

### *Switch Signal/Reference Control*

When the Switch Signal/Reference Control has been pressed, the paths of
the reference and input signal will be swapped. This can be used to
remove phase shift errors due to noise in the reference and the
underlying algorithm when precise phase shift measurements are required.
Phase shift inherent in the two signals will change sign when the two
paths are changed, whereas other shifts caused by the noise in the
reference and algorithm will not. Note that if the signal is buried in
noise, switching paths will not work. Also, if the signal is very noisy
compared to the reference, increasing the reference filter TC will be
required.

## 2. Filter Section

This section describes controls and indicators associated with the
output low-pass filter.

### *Type Control*

Several types of low-pass filters that are various incarnations of
either 10^th^ order IIR or 10^th^ order FIR filter can be selected.
Since the filters are 10^th^ order, they can have roll-offs ranging from
20 to 200 dB/decade. There are no constraints on the time constants
regardless of the type of the filter used.

Description of filter types:

1)  IIR (2-dig)

> Selects a 10^th^ order IIR filter and displays the time it takes
> filter to settle to 99 percent of its final value. Numerically, the
> IIR filter is less expensive than its FIR counterpart, so it can be
> used to speed-up calculation when time constants smaller than 10,000 x
> conversion interval are required. It can also be used to reduce
> filtering overhead when the conversion rate has to be increased. For
> example, if the conversion rate is 100 kHz, selecting the IIR filter
> option may allow the application to run on slower computers when
> filter time constants of 10 ms or less are required.

2)  IIR (5-dig)

> This filter setting is the same as the IIR (2-dig) setting except that
> the time required for the filter to settle to 99.999 percent of its
> final value is displayed.

3)  FIR\
    Selects 10^th^ order FIR filter. As mentioned previously, this type
    of filter is more time-consuming than the IIR version for time
    constants smaller than 10,000 x sampling frequency.

4)  FIR (ENBW)

> This filter setting is the same as the FIR, except that the time
> constant of the FIR filter is internally modified so that the
> Equivalent Noise Bandwidth (ENBW) becomes equal to that of the IIR
> filter with the time constant specified in the *TC (s)* control. To
> match the lower noise bandwidth of the IIR filter, the time constant
> must be increased, resulting in an increased settling time. Although
> increased, the settling time will still be shorter than the settling
> time of the IIR filter if five digits of precision are required.

5)  FIR (Sync)

> This filter setting is the same as FIR except that the time constant
> entered into the *TC (s)* control is coerced to the closest integer
> multiple of the reference frequency inverse. This is especially useful
> for smaller reference frequencies where the (ω~R~ + ω~S~) frequency
> component generated by the mixer can be very close to the DC
> component. For example, if the reference frequency is f~R~ = 0.1 Hz,
> the mixer will produce the desired DC signal as well as an unwanted
> frequency component at 2f~R~ = 0.2 Hz. It is the task of the low-pass
> filter to remove the unwanted frequency component. To attenuate this
> component by 60 dB, using a 4^th^ order IIR filter would require at
> least 50 or 90 seconds to settle to five digits. The FIR filter,
> however, has poles located at the integer multiples of 1/TC Hz and
> accomplishes this much faster. For example, a 3^rd^ order sync-FIR
> filter will attenuate the 2f~R~ component to more than 60 dB and
> completely settle in 30 seconds if its time constants are within 0.9
> to 1.1 of the 1/(2 f~R~). If the sync window can be calculated more
> precisely this time can be reduced to 20 seconds or less.

Changing the type control will not go into effect until the *APPLY*
button has been pressed. However, the *Settling Time* indicator will
change to show what the filter settling time will be with the new
option.

### *TC (s) Control*

Time constant of the low-pass filter in seconds. If the "FIR (ENWB)"
option is selected as a filter type, this is not the actual time
constant of the FIR filter, but is the time constant of the IIR filter
whose equivalent noise bandwidth we want to match. For an IIR filter, a
cutoff frequency (frequency attenuated by at least 3 dB with a
first-order filter) is equal to 1/(2 π TC) Hz whereas for the FIR filter
that frequency is about 0.35/TC Hz.

Changing this option will not go into effect until *APPLY* button has
been pressed. However, the *Settling Time* indicator will change to show
what the filter settling time will be with the new option.

### *Filter Roll-off Control*

Selects order of the filter. Changing this option immediately affects
the filter output since all stages of the filter are evaluated
simultaneously. Please note that the higher order filter outputs will
take longer to settle. The *Settling Time* indicator will change to show
what the filter settling time is.

### *Settle Time(s) Indicator*

Shows the time in seconds required for the filter to settle its output.
This value changes immediately when filter type, time constant, and
roll-off are modified.

### *Timer(s) Indicator*

Shows the time in the seconds expired from the last time the *APPLY*
button has been pressed. When compared with the *Settle Time(s)*
indicator, it can be used to determine if the filter has settled or not.
The timer does not restart if significant changes in the reference
frequency or input amplitude are detected. The counter can be zeroed by
pressing the *APPLY* button. Note that by pressing *APPLY* button you
will also reset the filter internals.

### *Reset Button*

This button resets the timer.

### *APPLY Button Control*

When pressed, any changes to the filter type and the TC(s) controls take
effect. Pushing this button also clears the filter stages and resets the
filter timer.

## 3. Signal Generator Section

This section can be used to control generation of limited set of
waveforms in SW (simulation). This option can be used to demonstrate
filter behavior using simulated signals.

### *Signal Generator Selector*

The pull-down menu selector is located immediately right from the
"Signal Generator" text. It can be used to turn the signal generation
from OFF to SW. Simulation (SW) mode requires no HW.

### *Ref Amp Control*

Determines amplitude of the wave generated on the reference output.

### *Sig Amp Control*

Determines amplitude of the wave generated on the signal output. The
amplitudes are matched with the corresponding entries in the *Frequency*
control to allow generation of multiple frequency components.

### *Frequency Control*

Determines the frequency of generated signals. The frequencies are
matched with the corresponding entries in the *Sig Amp* control to allow
the generation of multiple frequency components on the signal output.

### *Ref Shape Control*

Determines the shape of the generated reference signal.

### *Reference Noise (V) Control*

If different from 0, a gaussian noise pattern with standard deviation
specified by the control will be added to the sinusoidal reference wave.

## 4. Graphical Display Section

### *Graph Indicator*

Displays various plots selected by the *Plot* control

### *Plot Control*

Selects what is to be displayed on the Graph. These options are also
self explanatory and will not be discussed in detail.

The graph is updated at a rate equal to the sampling frequency divided
by the size of the data block that is processed at a time (see
*Configuration* section).

All options labeled "(Scope Mode)" display data acquired at the full
sampling rate and can slow down the application significantly. This is
because in each update all points acquired in the mean time must be
plotted. A partial speed increase may be achieved by limiting the number
of points visible on the graph.

Other options display the last 200 points worth of history and a new
point is added at the display update rate. For example, for a sampling
rate of 100 kHz and a block size of 10,000, the two digital displays and
the graph will be updated once every 100 ms, which translates to 20
seconds worth of data in the history buffer.

"Signal, Reference, Internal Ref (Scope Mode)" option displays three
curves on the graph using white, red, and green colors, respectively.
"Internal Ref" curve can be used to show how well the reference section
locked onto the reference signal.

To free-up processor time used for graph updating, the "*Off"* option
should be selected.

### *Backlog Bar*

Displays amount of data backlogged in the AI buffer. It indicates that
the processor cannot keep up with the incoming data if the bar grows
continually. Remedies include, but are not limited to, using faster
computer, increasing size of the data block, reducing acquisition speed
(can cause problems due to aliasing), disabling plotting altogether (or
not plotting scope mode data), choosing IIR filter for smaller
time-constants, etc.

### *DEMO Control*

In combination with information in the *Configuration* section, this
control can be used to pick one of the predefined AI configurations.

### *START Control*

The VI displays the welcome message until the START button is pressed.
If the START button has not been pressed, the STOP button cannot be used
to stop the execution of the VI.

## 5. Digital Display Section

Controls what data is displayed in the two digital displays and how it
is formatted.

### *Display Selection Control*

The Display Selection control is an unnamed pull-down menu located on
the left side of the two digital displays. The control is used to choose
what gets displayed in the digital displays. The first variable is
displayed in the upper display and the second variable is displayed in
the lower display. The settings are self explanatory but the
abbreviations may not be clear. They are shown below:

X, Y -- standard lock-in notation (please see introduction)

R or Amplitude -- standard lock-in notation (please see introduction)

θ or Phase - standard lock-in notation (please see introduction)

f~ref~ -- reference frequency

(Max, Min) -- maximum and minimum values of a given variable since the
last time *RESET MAX/MIN* button has been pressed.

### *RESET MAX/MIN Button*

This button will restart the tracking of the minimum and maximum values
for all variables.

### *STOP Button*

This button will stop the execution of the VI.

### *SI Notation Switches*

Switching these on will set the display mode of the corresponding
digital display from a floating-point (eleven digits + sign + decimal
point) to SI notation (one to three digits before the decimal point and
six digits after the decimal point).

### *Display Mode Control*

Display Mode control is an unnamed pull-down menu located on the right
side of the two digital displays. This control determines whether
quantities in both digital displays will be shown as amplitudes, RMS
values, or peak-to-peak values. This option does not affect quantities
for which it does not make sense, such as Hz, degrees, etc.

### *Digital Display Controls*

Digital displays are updated at a rate equal to the sampling frequency
divided by the size of the data block that is processed at a time (see
*Configuration* section).

### *Display Enable Control*

Display enable control is a button located on the right hand side of the
"Digital Display" text. If the button is turned OFF, the lock-in VI will
stop updating the Graph (see Graphical Display Section) and the two
digital displays, and stop keeping track of Min and Max values. This
should free some computer resources for other tasks. To disable the
digital displays without affecting the tracking of Min and Max values,
use the "Off" option in the *Display Selection* control.

## 6. Configuration Section

This section, shown below, is located on the left side of the lock-in
front panel and should be hidden from the view.

![](media/image2.png){width="6.495833333333334in"
height="4.903472222222222in"}

**Lock-In DEMO VI Front Panel (Hidden Configuration Section)**

### *AI Configuration Control*

This array control can be used to define multiple configurations of the
HW front end (device, AI channels, gains, coupling, acquisition speed,
data block size, acquisition buffer size). The predefined configurations
can be later selected via *DEMO* Control described previously. The first
channel in the channel list should be used for the signal and the second
channel in the list should be used as the reference input.

### *Greeting Message Control*

A message to be scrolled in the upper digital display once the VI is
started (also see Graphical Display section).

# Lock-in Engine VI

The lock-in engine consists of four VIs:

1.  LockinCheckLicense.vi

2.  LockinPLL.vi

3.  LockinDemodulatorSettings.vi

4.  LockinDemodulator.vi.

The controls, indicators, and functionality of these VIs are discussed
below. When using the VIs, you may also find it helpful to use the
Context Help Window by navigating to Help\>\>Show Context Help (Ctrl-H).
The documentation below is available there as well.

## LockinCheckLicense.vi

### ![](media/image3.png)*Description*

The VIs included in the NI Lock-In Start-Up Kit will stop working once
their license expires. This VI may be used to display a warning that the
license will expire within the month or that it has already expired.

### *Controls*

*Display Dialog* If set to true, the VI displays warning dialog

> Default value: True.

### *Indicators*

*License Expired* Set to True if the license expired.

*License Expires Soon* Set to True if the license will expire within a
month.

*Message* Message that is displayed in the warning dialog if enabled.
This message is set regardless of the state of the *Display Dialog*
flag.

## LockinPLL.vi

### *Description*

![](media/image4.png)The LockInPLL.vi is a software implementation of a
PLL algorithm (phase locked loop) whose main purpose is to measure the
frequency and phase of the reference signal. This information may then
be used to generate internal sine and cosine reference signals that are
mixed with the input signal(s). The reference signal can have a
frequency ranging from mHz to MHz and can be either a sine or a square
wave.

### *Controls*

*Signal(In)* A 2D-array. The *Data Column* control is used to specify
which column of the matrix contains the reference signal data.

Default value: none (input value required)

*fs* The frequency at which the data has been sampled.

Default value: none (input value required)

*Param* For the current version of the *LockInPLL.*vi to function
properly, the reference signal must be symmetric around 0. This
parameter may be used to offset the reference signal if that is not the
case. For example, if a TTL signal is to be used as a reference signal
and its levels are between 0.5 and 4.8 V, then the value of the
parameter should be about

(4.8 -- 0.5) / 2 \~ 2.2 V

Default value: 0

*Filter TC(s)* The PLL algorithm operates on blocks of reference signal
data to extract the required information. The larger the block size, the
better the estimate. The size of the block is determined as follows.

> By default, the algorithm uses three cycles worth of data unless the
> chunk of data passed to the VI is larger. In the later case, the whole
> chunk will be used to extract the relevant information. In the former
> case, the VI automatically accumulates the required amount of data.
> For example, if the sampling frequency *fs* is 102.4 kHz, the length
> of the input data is 10,240 samples, and the reference signal
> frequency is 1 kHz, the output of the PLL will represent the average
> over 100 reference cycles.
>
> If, on the other hand, the reference frequency is 10 Hz, the VI will
> use stored data from the last three calls to obtain the frequency and
> phase. The amount of data to average over can be increased via this
> control. For example, to average a 10 Hz reference signal over five
> cycles, one should select the time constant (TC) to be 0.5 s. The
> actual TC used is displayed in the *Filter TC(s) out* indicator (see
> the *Indicators* section). Note that the default value of three cycles
> can be selected by typing 0 in the control and also represents the
> minimum TC. Finally, note that the TC can only be a multiple of the
> reference signal period and that other values will be rounded off to
> the [nearest]{.underline} integer multiple.
>
> Default value: 1 second

*Data Column* Specifies which column in the input 2-D matrix contains
the reference signal data.

Default value: 1

*Function* Selects the shape of the reference signal. The *Sine (sync)*
option is a special case of the *Sine* option where the output of the VI
will change only if a positive slope zero crossing has been detected in
the latest block of input data. The *Square* option is always
synchronous. This behavior may be useful for lower reference
frequencies.

Default value: Sine

*Init* When set to true, this Boolean control initializes the internal
data structures of the VI. It is recommended that this parameter be set
to True at the beginning of a new experimental run to clear the VI's
history buffer.

Default value: False

*Order* Selects which harmonic of the reference frequency to lock onto.
Acceptable values are integers between 1 and n where n \* reference
frequency is smaller than ½ of the sampling frequency *fs*. For example,
for *fs = 102.4 kHz*, and a reference frequency of 300 Hz, the maximum
value of n is

n~max~ = \|\_ ½ \* 102400 / 300\_\| = \|\_170.67\_\| = 170

> If requested order n is not within allowed range, i.e., 1 ≤ n ≤
> n~max~, it will be coerced to one of the limit values and error (-3)
> will be reported via the *Lock Error* indicator (see the *Indicators*
> section).
>
> Default value: 1

### *Indicators*

*Signal (out)* Feeds through the 2D-Array of sampled data that was
passed to the *Signal (in)* control (see the *Controls* section).

*Reference Info* This structure is used to pass information back to the
caller. The cluster consists of the following members:

> *fr* Measured reference frequency
>
> *Phase* Measured reference phase with respect to the beginning of the
> data block
>
> *Order* Coerced value (if necessary) of the Order control (see the
> Controls section)
>
> *Updated* True if reference data has been updated in this call (see
> the Function and Filter TC (s) controls in the Controls section)
>
> *Block Size* Size of the data block passed to the VI via the Signal
> (in) control (see the Controls section)
>
> *fs* Sampling frequency passed to the VI through the fs control (see
> the Controls section)

*Filter TC(s) out* Actual filter time constants used.

*Lock Error* If non-zero, an error has occurred while trying to PLL to
the reference signal.

> Currently supported warnign codes:

License about to expire (1)

The NI Lock-In Start-Up Kit License will expire within a month.

> Currently supported error codes:
>
> Range Error (-1)
>
> A reference frequency out of range has been detected.
>
> Sampling rate error (-2)
>
> Sampling rate is less than 50 kHz.
>
> Order overflow error (-3)
>
> Selected order does not satisfy ceiling requirement discussed
> previously (see the *Order* control in the *Controls* section).
>
> License Expired Error (-4)
>
> The NI Lock-In Start-Up Kit License has expired.

## LockinDemodulatorSettings.vi

### *Description*

![](media/image5.png)This VI calculates some of the internally used
settings for the mixer and low-pass filter blocks in the demodulator VI
as well as the actual low-pass filter time constant and settling time.

### *Controls*

*Reference Info* A cluster populated by the *LockInPLL.*vi. The cluster
contains information necessary to generate mixer and low-pass filter
parameters.

Default value: none (input value required)

*LP Filter Info* Time constant (*TC*), rolloff (*Rolloff*), and type
(*Type*) of the low-pass filter. For a more in-depth discussion about
the filter and its options, please see the *Filter* section.

Default value: none (input value required)

### *Indicators*

*LP Filter Settings* Lock-In Engine private filter settings

*TC(s)* Actual time constant (TC) of the low-pass filter. For a more
in-depth discussion about the filter and its options, please see the
*Filter* section.

*Settle Time (s)* Time in seconds that will be required for the low-pass
filter to settle if the current filter settings are applied to the
low-pass filter. For a more in-depth discussion about the filter and its
options, please see the *Filter* section.

## LockinDemodulator.vi

### *Description*

![](media/image6.png)This VI extracts a frequency component from the
input signal whose frequency and phase are specified by the reference
signal.

### *Controls*

*Signal (In)* A 2D-array of doubles. The *Data Column* control is used
to specify which column of the matrix contains the input signal data.

> Default value: none (input value required)

*LP Filter Settings* Filter settings generated by the
*LockinDemodulatorSettings.vi*.

Default value: none (input value required)

*Phase Shift* Inserts phase lag (in degrees) into the internal reference
signal. Phase lag may be necessary to maximize the X or Y components
when the signal arriving at the lock-in is phase shifted with respect to
the reference signal. For more information see the *Introduction* and
*Reference* sections.

> Default value: 0

*Filter Data (in)* This control may be used for passing a pre-allocated
array of double floating-point numbers which array may contain, upon
return (via the *Filter Data (out)* indicator), the following data: the
internal sinusoidal reference that has been mixed with the signal if the
number of columns in the matrix is one or three; and outputs of the X
and Y component low-pass filters for each point passed in the *Signal
(in)* parameter if the number of columns in the matrix is two or three.
The X and Y component information is always returned in columns zero and
one and the reference information is returned in column zero or column
two, respectively. The sine wave is of unit amplitude. The data will be
generated only if the number of rows of the 2-D array is equal to the
number of rows of the input 2-D array (see the *Signal (in)* control).

> Default value: empty array

*Apply* Changes in the low-pass filter time constant and type do not
become effective immediately even though the *Settle Time (s)* and *TC
(s)* indicators of the *LockinDemodulatorSettings.vi* follow the
changes. Instead, the changes become effective only after this Boolean
control has been set to true. The flag causes filter internals to be
re-initialized so it should be set to true for one call only. For a more
in-depth discussion about the topic, please see the *Filter*.

> Default value: False

*Data Column* Specifies which column in the input 2-D matrix (see the
*Signal (In)* control description) contains the reference signal data.

> Default value: 0

### *Indicators*

*Signal (out)* Feeds through the 2D-Array of sampled data that was
passed in via the *Signal (in)* control (see *Controls* section)

*Filter Data (out)* Internal filter data if requested (see description
of the *Filter Data (in)* control in the *Controls* section).

*Data (out)* A 2-D array containing X and Y components of the input
signal at the frequency of the reference signal for all filter roll-off
values (one per column). Note that all filter stages necessary to obtain
different roll-offs are calculated in parallel so that one can pick the
output of any stage without paying a "re-settling time" penalty. For
more about the topic, please see the *Filter*.