Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
DqaCmd Command-Line Remote Control
DqaCmd is a command-line remote control program that takes a Daqarta macro command as its parameter. For example,
will set the Main Frequency (Tone Frequency) for Left Stream 0 to 1000 Hz. You can give multiple macro commands on the same line by separating them with commas. The total macro length is limited to 1024 characters. (You can increase this up to 16384 by changing Cmd_Buffer in the included DqaCmd.ASM source code and reassembling.)
One way to use DqaCmd is in a standard batch file, which may also launch Daqarta before any DqaCmd line. You would typically have some batch commands that control your own custom hardware or system, interspersed with DqaCmd lines to control Daqarta as needed.
Another way to use DqaCmd is to have your custom program build up the command line and issue it when desired. You can use whatever programming language you are comfortable with, as long as that language is capable of launching other programs.
In both of these cases, the batch file or your program must be able to find DqaCmd.EXE in order to run it. Rather than including a full path with each invocation, you can simply copy the file to the location you will be running from.
DqaCmd does not return to the command prompt until the macro or macros are completed, unless there is an error. If you use it in a batch file, you can check the errorlevel value on return to make sure there was no error, or take any desired action if there was. To see the errorlevel, include this line after the DqaCmd line:
Similarly, if you invoke DqaCmd from another language, you can check the return value. A complete listing of the possible values and their meanings is given in DqaCmd.ASM.
The reason that DqaCmd waits until the macro commands are completed before returning, is to prevent your batch file or program from proceeding too soon. For example, suppose the commands start an average and use WaitAvg or WaitPause event-wait macros to wait until it is done, then save data to a .TXT file. If DqaCmd returned as soon as the command string was issued, the batch file (or your custom program) would proceed before the average even got started... or the desired data file saved.
If your macro commands generate errors (for example, you have a typo so that 'ToneFreq' becomes 'ToneFraq'), Daqarta will generate an error message box (in this case 'Macro name not found') and wait for you to manually click 'OK' before proceeding. To prevent the message box, you can precede the command string with a '*' character, as in:
Then you can handle the error code (number 2 in this case) as you desire. In general, of course, it is much better to test everything ahead of time before committing it to your test routine. (See the DqaDlg remote control demonstration program.)
In rare circumstances you may need the ability to cancel a running macro. You can do this with:
No other commands may be given at this time. DqaCmd will promptly return with code number 16 = 'Macro cancelled', after which you can proceed with new commands. Note that this only cancels the macro, so it doesn't proceed to the next step... it does not, for example, cancel an average that the macro may have started. It is exactly the same as hitting the Cancel button in Daqarta's Macro Dialog.
However, note that as mentioned above, DqaCmd does not return until the original macro commands are completed. This means you can't cancel a running macro from a normal command line or batch file. If you invoke DqaCmd from your own program, the Cancel command will need to be given from a separate Windows thread that is not blocked while waiting for the original DqaCmd to return. It may be simpler to directly incorporate the low-level message mechanism into your own program to avoid this issue.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2020 by Interstellar Research
All rights reserved