Analog output scripts
Analog output scripts let you program timed sequences of analog output voltages ("scripts") from either of the two analog output channels on National Instruments cards.  These can be used to control any instrument or other external device that responds to voltages (0-5 volt range).  You can program two separate scripts, one for each channel, that run simultaneously and independently (but you cannot use channel 2 for both output scripts and feedback control at the same time).  There are separate (but identical) menu selections for setting up scripts for each of the two AO channels ("Analog out #1 script" and "Analog out #2 script").

  • Remember that the outputs can supply low-current control voltages only

Each AO script can contain up to 100 steps.  For each step you need to specify:

  • the output voltage, which may be constant or 'ramped' (gradually changing between the starting and ending values). 
  • the duration of the step (any duration may be entered in the edit field, but time is measured in units of 1/60 second so no step can be shorter than this). 

When these data are entered, press the 'add step' button to append the step to the script.  As steps are added or modified, the computer shows a graphical display of the current script, including the total number of steps and the cumulative time (see example below).

For the script as a whole, you need to set:

  • the starting condition (when the script sequence starts: at the first sample, at the first marker, or at marker 's'). 
  • the ending condition (when the script sequence stops: at the end of the script sequence, at marker 'x', or at marker 'q').  AO script sequences can come to an end end in several different ways.  If a loop exists, the script will run indefinitely until data gathering ceases, unless the operator intervenes and stops the sequence.  Alternately, if a script doesn't contain a loop, it will simply end after all the steps have been completed -- again, the operator can stop the sequence manually. 
  • the pre-run volts (the voltage output before the script starts).  This voltage normally appears when data acquisition starts, but you can switch it on immediately by clicking the 'switch to pre-run value' button, which sends the value in the 'pre-run volts' edit field directly to the voltage output port. 
  • the post-run volts (the voltage level after the script stops).  If you use the 'keep existing voltage' option for the end of script condition, the computer will maintain whatever voltage was present when the script ended.  Because you can stop a script at any point ('x' or 'q' keys; see above), This is less predictable than the alternative 'set volts to' option, which always ends the script with the same voltage. 

Scripts may loop back upon themselves, in which case they will run indefinitely unless interrupted by an ending condition or by the conclusion of sampling.  A loop can return to any step in the script.

You may modify a script by editing any step ('update' button), appending new steps ('add step' button), inserting new steps into the middle of the sequence ('insert' buttons), removing any step ('delete' button), or removing the entire script ('clear' button).

You can store and retrieve output scripts using the Open and Save selections in the D-A menu.

  • CAUTION:  using analog outputs may slightly reduce the maximum possible sampling rate.  At less than maximal rates, it has little or no effect on acquisition speed. 

The AO script setup window looks like the example at right:

This script (for output channel 1) contains 13 steps (plus a returning 'loop' step) lasting a total of 17 minutes.  Ramped outputs occur in steps 1, 2, 4, 6, 8, 10, and 12.  At the end of the sequence, a loop returns control to the first step.  The script sequence will terminate if the "x" key is struck.  It will start when the "s" key is struck (this is shown being selected from the pop-up menus in the upper right corner of the window).  The pre-run voltage is zero and the post-run condition (when the "x" key is struck or data gathering ceases) is to switch to a value of zero volts.

go to: