Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Specific Scripts Cause Incorrect Behavior When Using Script Triggers in NI-RFSG 1.2

Primary Software: Driver Software>>NI-RFSG
Primary Software Version: 1.2
Primary Software Fixed Version: N/A
Secondary Software: N/A
Hardware: Modular Instruments>>RF Measurement Devices>>PXI-5660, Modular Instruments>>RF Measurement Devices>>PXI-5600, Modular Instruments>>RF Measurement Devices>>PXI-5610, Modular Instruments>>RF Measurement Devices>>PXI-5671

Problem:
Why does nesting a repeat until scriptTriggerX instruction in a repeat Forever instruction not work properly with the NI-RFSG 1.2 driver?

Solution:
The script language introduced with NI-RFSG 1.2 and used by NI RF signal generator products is a very flexible technology. However, there are a few very specific scripts that, when combined with specific instructions, do not work as intended. These scripts involve nesting a repeat until scriptTriggerX instruction in a repeat Forever instruction. For example, the following script does not work as intended:

script myScript0
repeat Forever
repeat until scriptTrigger0
generate wfmSine
end repeat
generate wfmSquare
end repeat
end script


The script is intended to program the arbitrary waveform generator (AWG) to generate the waveform wfmSine continuously until scriptTrigger0 is TRUE. Then the script should generate wfmSquare, and then loop back to repeat wfmSine until the scriptTrigger0 instruction, and so on. Unfortunately, after receiving the first scriptTrigger0, generating wfmSquare once, and looping on wfmSine the second time, a second scriptTrigger0 causes the generation to terminate. The following workaround requires adding a line to the script to call another scriptTriggerX.

  1. Configure another scriptTriggerX (for example, scriptTrigger1) as a digital level script trigger with the niRFSG Configure Script Trigger Digital Edge VI.
  2. Configure the active level for the desired trigger as Rising Edge and configure the source as PFI 0. Low is not a prefilled value and must be entered manually. The following figure is an example of the niRFSG Digital Edge Script Trigger VI.

    LabVIEW Code Portion
  3. Add an extra repeat until scriptTriggerX instruction around the generate wfmSquare instruction. Follow the repeat... statement with the end repeat instruction to complete the repeat until... line.

The following script is an example of the workaround for this example:

script myScript0Fixed
  repeat Forever
    repeat until scriptTrigger0
      generate wfmSine
    end repeat
    repeat until scriptTrigger1
      generate wfmSquare
    end repeat
  end repeat
end script

Though the generate wfmSquare instruction is in a repeat until.. instruction, scriptTrigger1 is configured so that the trigger is always asserted, and thus wfmSquare is generated only once before moving to the next instruction.

The following scripts also require workarounds similar to the previous example:

The following script generates the wfmSquare instruction once, loops forever, and generates wfmSine inside a repeat until scriptTrigger0 loop. After the first trigger the waveform generation prematurely ends. The workaround is similar to the previous example: add an extra repeat until scriptTriggerXaround the generate wfmSquare line. The scriptTrigger instruction is configured as before. The following table illustrates the workaround for the original script in this example:

IssueFixed Version
script myScript1
  generate wfmSquare
  repeat Forever
    repeat until scriptTrigger0
      generate wfmSine
    end repeat
 end repeat
end script
script myScript1Fixed
  repeat until scriptTrigger1
    generate wfmSquare
  end repeat
  repeat Forever
    repeat until scriptTrigger0
      generate wfmSine
    end repeat
  end repeat
end script

The following script is designed to wait until receiving a scriptTrigger0 before moving on to the repeat Forever statement and starting waveform generation. It also prematurely ends once the second scriptTrigger is received. The fixed version uses a dummy waveform of zeros. This empty waveform is generated until scriptTrigger0 occurs, and then the desired waveform is generated. The wfmZeroes instruction should have the minimum number of samples supported by the specific module to minimize delay from the trigger to next step of the script. Note that this solution does not require the extra scriptTrigger as described for the previous examples.The following table illustrates the workaround for the original script in this example:

IssueFixed Version
script myScript2
  wait until scriptTrigger0
  repeat Forever
    repeat until scriptTrigger0
      generate wfmSine
    end repeat
  end repeat
end script
script myScript2Fixed
  repeat until scriptTrigger0
    generate wfmZeroes
  end repeat
  repeat Forever
    repeat until scriptTrigger0
      generate wfmSine
    end repeat
  end repeat
end script


Related Links:
Drivers and Updates: RF Measurement Hardware

Attachments: