4.4 Basic syntax rules

Table 4.1 shows a simple example from the Bruker pulse program library. It is used to demonstrate some of the most important programming rules. 

;zgcw30 
;avance-version 
;1D sequence with CW decoupling 
;using 30 degree flip angle 

#include <Avance. incl> 
1 ze 
d11 pl14: f2 
d11 cw: f2 
2 d1 
p1* 0.33 ph1 
go= 2 ph31 
wr #0 
d11 do: f2 
exit 

ph1= 0 2 2 0 1 3 3 1 
ph31= 0 2 2 0 1 3 3 1 

;pl1 : f1 channel -power level for pulse (default) 
;pl14: f2 channel -power level for cw/ hd decoupling 
;p1 : f1 channel -90 degree high power pulse 
;d1 : relaxation delay; 1-5 * T1 
;d11: delay for disk I/ O [30 msec] 

Table 4.1 Pulse program example
  1. Pulse programs are line oriented. Each line specifies an action to be executed by the acquisition hardware or software.
  2. A semicolon (;) indicates the beginning of a comment. You can put it anywhere in a line. Following its occurrence, the rest of the line will be treated as a comment.
  3. #include <filename> or #include "filename" This command allows you to use pulse program text, which is stored in another file, in your pulse program. It helps you to keep your pulse program reasonably sized, and to re-use the same code in other pulse programs. By convention, if the filename is given in angle brackets (< >), the file must be stored in the working directory $XWINNMRHOME/ exp/ stan/ nmr/ lists/ pp/. Alternatively, double quotes (" ") are normally used to specify the entire path name of the file to be included.
  4. 1 ze

  5. Any pulse program line may be preceded by a label (" 1" in this case). You need to label only those lines which must be reached by loop or branch commands such as go= label, lo to label times n, goto label. You may also use labels for numbering the lines of a pulse program. Labels need not necessarily be numbers. You can also use an alphanumeric string, followed by a comma, e. g. first-label, ze
    The command ze serves the following purpose:
  6. d11 pl14: f2

  7. Execute a delay whose duration is given by the acquisition parameter D11. Behind any delay command, you may specify further actions to be executed during the delay (provided the duration chosen was sufficiently large). In this example, the power level of channel f2 is switched to the value given by the acquisition parameter PL14.
  8. d11 cw: f2

  9. Execute a delay whose duration is given by the acquisition parameter D11, and, at the same time, turn on continuous wave (cw) decoupling on frequency channel f2. Decoupling will remain active until explicitly switched off with the command do: f2. This delay and cw decoupling will begin immediately after the end of the delay specified in item 5 above.
    Items 5 and 6 illustrate a general feature of pulse programs: The actions specified in two adjacent lines are executed sequentially. Actions specified within the same line are started simultaneously and execute in parallel.
  10. 2 d1

  11. Execute a delay whose duration is given by the acquisition parameter D1. This line is preceded by the label "2", which is where the command go=2 loops back to.
  12. p1* 0. 33 ph1

  13. Execute a pulse on frequency channel f1 whose duration is given by the acquisition parameter P1, multiplied by 0. 33. For convenience, P1 is often used to hold the pulse width for a 90 degree flip angle. The command p1* 0.33 would then execute a 30 degree pulse. In general, you may specify the operator * behind (not before!) a pulse or delay command, followed by a floating point number. Please note that the channel f1 does not occur explicitly: If no channel is given, f1 is assumed, and the command p1* 0.33 is identical to p1* 0.33: f1.

    The pulse is executed with a power (amplitude) defined by the acquisition parameter PL1. PL1 is the default power level for channel f1, but you may also use a different parameter. For example, the command pl7: f1 would set the channel f1 power from the parameter PL7. You would not specify, however, this command in the same line as p1* 0.33, but previously, along with a delay, in order to give the transmitter time to settle before the pulse is executed.

    The phase of this pulse is selected according to ph1 with ph1 being the name of a phase program or phase list, to be specified behind the pulse. It is defined at the end of the pulse program, in our example ph1= 0 2 2 0 1 3 3 1. The phase of the pulse varies according to the current data acquisition scan. For scan 1, p1 will get the phase 0* 90 degrees, for scan 2 2* 90, for scan 3 2* 90, for scan 4 0* 90, etc. After 8 scans, the list is exhausted. With scan 9 the pulse phase is cycled, i. e. it restarts with the first phase in the list. Phase cycling is a method of artefact suppression in the spectrum to be acquired. Cycling the pulse phase requires the receiver phase to be cycled accordingly to ensure that coherent signals of subsequent scans will accumulate rather than cancel. This is achieved by the receiver phase program ph31 in our example.

  14. go= 2 ph31

  15. Execute 1 data acquisition scan, then loop to the pulse program line with label "2" until NS scans have been accumulated, NS being an acquisition parameter. The NS scans are preceded by DS dummy scans (because the command ze is used at the beginning of the pulse sequency rather than zd). A dummy scan does not acquire any data, but requires the same time (given by the acquisition parameter AQ) as a true scan. Dummy scans are used to put the spin system of the sample into a steady state before acquisition starts. The receiver phase is changed after each scan as described above for the pulse phase. Phase cycling is based on the phase program ph31. Phase cycling is also employed during the execution of dummy scans. DS and NS should therefore be a multiple of the number of phases in the list.

    The go = label command executes a delay, the so-called pre-scan delay to avoid pulse feed through before it starts digitizing the NMR signal. During this time the receiver gate is opened, and for certain instruments the frequency is switched from transmit to receive. You can read more about DE and its components DE1, DE2, DEPA, DERX and DEADC in the chapter The Acquire Menu. Normally, you can accept the default DE value suggested by the program. The total time the go= label command requires to execute a scan is DE+ AQ+ 3 milliseconds. The last duration is required for internal reasons, namely the preparation of the next scan. The 3 msec are valid for Avance type instruments. Older instruments require 6 milliseconds.

  16. wr #0

  17. Writes the accumulated data as file fid into the EXPNO directory of the current data set. Please note that the way the zgcw30 pulse program is built data are not stored on disk before all NS scans have been accumulated. However, while acquisition is in progress, you can force the program at any time to store the data acquired so far, by entering the command tr on the keyboard (or by calling it from the Acquire menu). You may process and plot this data while the acquisition continues. If you want to protect your data against power failures during long term experiments, we recommend that you write the data on disk in regular intervals, for example every 1000 scans. To accomplish this, you would set NS= 1000, and add the line lo to 1 times 30 before the exit command. The pulse program would then accumulate 30. 000 scans totally, but store the result every 1000 scans. Please note that the loop must branch to the ze command. The reason for this is that wr #0 adds the last acquired data to the data already present in the file. The real time fid display will only show the data currently present in the acquisition processor's memory.
  18. exit

  19. Signals the end of the pulse program.

HTML version by Janos Rohonczy
Copyright © 1998-2001 BRUKER Analytik GmbH. All rights reserved.