Daqarta for DOS Contents



Free Registration

Contact Us
Daqarta for DOS
Data AcQuisition And Real-Time Analysis
Shareware for Legacy Systems

From the Daqarta for DOS Help system:


Suppose your signal is much longer than the screen, maybe many seconds long. To capture that for later analysis you need to use DDisk to save the whole thing to a file. Your Key Macro will need to start with the trigger operation, followed by DDisk. But you can't use Singl here, since that will Pause after the first N points, before the DDisk command. Instead, you can take advantage of the WaitP (ALT-W = Wait for Pause) option:

Note that Key Macros normally execute recorded keystrokes in rapid succession, with no acquisition or display sweeps between them like you would have when entering those same keys manually. But when WaitP is active, sweeps are obtained after each recorded key until a Pause arrives to deactivate WaitP. Then the remaining keys resume executing at full speed.

However, your macro doesn't need to wait for a Pause: After the first sweep, it can give another WaitP to toggle that off, and then zip through the other keys. In the simplest case, the key options in the macro would be:

    WaitP, unWaitP, DDisk, Enter, unDDisk

The unWaitP notation is used here for clarity, to indicate that the second hit of the WaitP key will toggle it off. The Enter is the confirmation of the default file name prompted by DDisk. More on unDDisk in a moment.

So, assuming you have previously set the trigger to Norm mode and adjusted the trigger level for your signal, and assuming you already have the Board active in RTime mode as needed for DDisk recording (all of which could be done with other macros), then the first WaitP will stop and wait for the sweep to complete. When the trigger arrives (and the sweep appears on-screen), the second WaitP (shown as unWaitP) will immediately stop waiting for sweeps and go right to start the DDisk recording.

But wait! No matter how fast those keys are executed, the fact remains that the trigger event has already passed. If you simply start DDisk recording normally, you will only save events that happened AFTER that point. Here is where DDisk PreStart can be put to good use: It tells DDisk to reach back into the circulating data buffer and start the recording up to 15000 samples earlier (up to 30000 with 8-bit data). That's usually more than enough to capture the trigger event with room to spare, even allowing for fast sample rates and slow DDisk file setup time on mediocre CPUs.

In fact, there is time to change the trigger mode or simply toggle Trig off after the second WaitP, before DDisk starts, if you prefer a different view of the data during the recording.

The most useful approach is usually to Preset the DDisk file size, so that this whole operation can run unattended. You can even invoke this macro with a Loop command to collect any number of files using the IncNm option to auto-increment the file names. But note that if you want any operations to take place after the Preset recording ends (like changing parameters for the next recording, or even just continuing with the rest of the Loop), you need to tell the macro where the end of the DDisk macro keys are so it won't zip through the remaining keys before the recording ends.

So you need to end the DDisk section of the macro with a "terminal" D-key, shown above as unDDisk for clarity. This is the normal command to toggle DDisk recording off, but if you create the macro (with KeySt) while the Preset size is non-zero, it actually stores a special command to wait for the automatic end at whatever file size was specified.

Note that if you were not using the Preset size option, you would need to insert a WaitS delay after the initial DDisk or else the recording would end immediately; the KeySt process does not record the time you take between key presses.

To tell the macro system that the second D-key is just a marker to wait for the Preset end, it's important that the key arrive during the actual Preset recording interval when you are creating the macro. If you wait too long, and the Preset ends the recording before you hit the key, then that D-key will simply toggle DDisk back on again... not what you want!

But if you want to use a short Preset size, you may not be able to hit the key sequence fast enough, especially if there are some other key operations you want to include before the end of the recording. The solution is simple: Just for the purpose of setting up this macro, use an extra-large Preset size to give yourself plenty of time. Don't worry about the exact length of this initial file... you can always delete or overwrite it later. Then after you end the macro KeySt, you can set the desired Preset. You may want to have a "setup" macro that does this along with setting modes and trigger levels, which at run-time could be invoked before the DDisk macro.

Your macro can do other things during the DDisk recording, including invoking other macros or macro Loops. But you must make sure that the unDDisk comes at the same macro level as the DDisk that started the recording... you can't invoke another macro that does that. When the Preset end arrives, the macro handler will skip ahead to the unDDisk command, breaking out of any Loops and ignoring any other commands or macros along the way. Your macro should thus have a structure like:

    ... DDisk, Enter, {other macro commands}, unDDisk, ...

Those other commands could all be rolled into a single macro "subroutine", which will not only make things easier to modify, but will be faster to key in when you are storing the main DDisk macro and the disk is running.

Before you run your macro, you will need to (manually or via other macros):

  • Set Board active in RTime mode.
  • Set trigger Mode to Norm.
  • Set trigger Slope and Level to detect desired event.
  • Set DDisk Preset file size for length of event.
  • Set DDisk PreStart to 15000 (or as needed) to capture start of event.
  • Make sure trace is Live (unPaused).

That last item is important, since the example macro assumes the trace is Live. If it's not, DDisk will not start... it will wait for an unPause that never comes (until you ESCape from the macro). If you will normally be starting from a Paused state, you might consider putting an unPause P-key in front of the first WaitP, or better yet using KeyOn followed by one P-key to force a Pause, and a second to unPause.

HOWEVER, you should also consider that no data is going into the data buffer during Pause... it just sits there holding whatever data was last acquired. So in the case that the trigger event comes immediately after the unPause there will be old "data" ahead of it in the buffer, whatever was there at the start of the Pause. When PreStart reaches back to include the trigger event, that old data will appear in front of it and could easily get confused with the new trigger data.

This is really a non-issue if you have control over when the macro starts relative to when the trigger event arrives, since you can start the macro, and then after a moment's delay start whatever process will generate the trigger. But if the trigger events come unpredictably, and you want to use this auto-unPause method, you should add an appropriate delay in the macro to let the buffer accumulate a "cushion" of silence before the trigger event shows up. Use the WaitS (SHIFT-W = Wait Seconds) option for this, which defaults to 1 second. You can change this via CTRL-SHIFT-W to get any delay you want, from microseconds to millenia. The macro will then look like:

    KeyOn, Pause, unPause, WaitS, WaitP, unWaitP, DDisk, Enter,
     {other macro commands}, unDDisk, {more}

To review:

  • KeyOn, Pause forces a Pause, regardless of initial state.
  • unPause resumes data acquisition immediately.
  • WaitS delays (one second, etc) to allow the buffer to fill.
  • WaitP stops macro key processing and waits for a sweep.
  • After the trigger causes a sweep, unWaitP resumes fast processing of macro keys.
  • DDisk prompts for a file name.
  • Enter accepts the default (typically using IncNm) and immediately starts saving data to disk, having reached back by PreStart samples to include the trigger event.
  • may appear during recording.
  • The unDDisk command serves as a placemark. Macro execution will wait for the equivalent command to come automatically when the Preset file size is reached.
  • Macro execution continues if there are commands after this.

In general, whenever you are creating any complex Key Macro, break it down into a series of smaller "building block" macros wherever reasonable. These can then be called in various ways from other macros. This technique allows you to go back later and change one of the sub-macros when your needs change, without having to re-enter an entire long key sequence. For the same reason, it makes it easier to handle any key-entry mistakes.


Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
25 Years of Innovative Instrumentation
© Copyright 1999 - 2006 by Interstellar Research