Duplicate commands with auto-increment parameters

sample application animated gif

Click on the image to see the full-size animation.

DAPstudio provides an easy way to reproduce a command with auto-increment parameters. If you have a large number of channels, this feature is particularly useful. It allows you to copy and paste commands – even multiple commands – for multiple channels without manually changing the number in each command line.

This application samples four channels at 1000 samples per second per channel and decimates the data rate by a factor of 100 by applying the AVERAGE command on each input channel pipe.

To see an example, enter a command line in the DAPstudio Processing|Procedures|DAPL Listing edit box.

Average(IP0, cCnt0_, pAvg0)

You then can use a simple Ctrl-C (copy) and Ctrl-E (increment/paste/copy) keystroke sequence to add additional Average command lines. They will look like this.

Average(IP1, cCnt0_, pAvg1)
Average(IP2, cCnt0_, pAvg2)
Average(IP3, cCnt0_, pAvg3)

Use this shortcut as many times as you need to. The increment/paste/copy operation does not just duplicate your lines of code with new numbers, it also duplicates all required structure declarations to support that code. So, after using Ctrl-C/Ctrl-E, you can run your application without any more work.

While in this application you only duplicate one command, the increment/paste/copy command works just as well for multiple commands.

  1. Select File|New.
  2. Select 4 from the Channels combo box.
  3. Type "Average(IP0, cCnt0_, pAvg0)" in the Processing|Procedures|DAPL Listing edit box. Please see App0401 for step-by-step instructions on adding a DAPL command. Using the underscore ensures that the constant cCnt0_ will not be incremented.
  4. Highlight the line for the Average command and its parameters.
  5. Press Ctrl-C on the keyboard to copy the highlighted items to the clipboard.
  6. Go to the next line, before end, and press Ctrl-E to increment/paste/copy the items from the clipboard. Where a parameter has a number at the end, the number automatically is incremented when it is pasted to the new line. The new command line reads Average(IP1, cCnt0_, pAvg1).
  7. Repeat step 6 twice to insert two additional Average commands.
  8. Select the Processing|Declarations tab and change the value of constant cCnt0_ from 10 to 100.
  9. Select the Processing|Send To PC tab.
  10. Highlight all channels with the mouse or change focus to the checkbox area and select Ctrl-A. Then press the space bar. The IP0 through IP3 checkboxes are now unchecked, and instead the pAvg0 through pAvg3 checkboxes are now checked.
  11. Open Window|Graph.
  12. Select Start! or press Alt-S on the keyboard.