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:


Sometimes you may need to set a parameter to a random value. If you are running things manually, of course, you can just enter any value you wish. But if you need to generate a series of random values automatically from within a macro, there is a special way to do that. This method will work with any parameter that can be changed by direct value entry.

Instead of entering the value, enter the upper limit for the random value range. Hit ALT-# (actually ALT-3) instead of the ENTER or CTRL-ENTER you would normally use. You will then be prompted for the lower limit of the random value range. Enter that normally, ending with ENTER, and you will be prompted for a step size. This allows you to specify a quantization for the random values, such as 100 Hz or 2 msec steps. (Of course, you don't enter the 'Hz' or 'msec' units... just the prefix, if any, in ordinary direct entry format.) Use ENTER to end the step entry, and a random value will be sent to the parameter being adjusted. A step entry of 0 gives the smallest possible steps, with no quantization.

Random values have a uniform distribution over the selected range. The values are drawn from a sequence of over 2 billion 32-bit (9+ digit) pseudo-random values that are then scaled to the selected final range.

The range is determined simply by subtracting the lower limit from the upper, and the scaled and step-quantized random value is then added to the lower limit. So, for example, if you set a step value of 100 and a lower limit of 327, the possible values would be 327, 427, 527, etc.

Note that these random values are only those sent to the menu item... they may not be the same as those actually set as parameter values. For instance, the Virtual Source only allows integer Frequency values. If you send it a fractional value, either by manual direct entry or via the random value system, it will always be rounded to the nearest integer.

If you wish to send the random value entry to a comment field, you must use the CTRL-1 to CTRL-5 field selector with either the lower limit or step entries, since you need to use ALT-# with the initial upper limit entry.

If you are going to use random values in an Auto-Initialize Key Macro, you may want to begin it with the Randomize command to insure that each session is different.


The values generated by the random value process are known as "pseudo-random". To visualize the process, imagine a large container filled with 2,147,483,647 sequentially-numbered balls. After thoroughly mixing, the balls are drawn out one at a time (without replacing them) to produce a random sequence of numbers from 1 to over 2 billion. To produce a random number of (say) ten digits, you record only the last digit of each of the next ten balls drawn. Whenever you need another ten-digit number, you just draw out ten more balls. When you have drawn the last ball, put them all back in and start over.

For all practical purposes this would be "truly" random, except for the final step: In this system when you refill the balls and start over, you always draw the balls in the exact same sequence. In practical terms, this means that if you created an Auto-Initialize Key Macro that set a series of random values on start-up, they would be the SAME series of values each time you started a session. Each session alone would look truly random, and you would never know that it wasn't unless you compared one session to the next. This random-but-repeatable aspect is known as "pseudo-random".

This can come in handy if you want a "random" sequence that can be precisely replicated each session, but what if you want each session to be totally random, unrelated to any other? Here is where the Randomize command is used. This is the same ALT-# (really ALT-3) key used for random value entry, only in this case you use it when you are NOT in direct entry mode. In this case it behaves as a normal option command which will "throw all the balls back in, mix them up, and change to a completely different sequence of drawing them out."

To insure that the new sequence is different from run to run, the system time and date plus various internal system timers are used to provide random numbers to control the setup. Even if you reset your system time and date just before starting each session, you will still not change the internal timers, so random entries now become truly random.

You only need to give the Randomize command once, at the start of the Auto-Initialize macro, to get the full benefits. (But it won't cause any problems to use it more than once.) If you don't use an Auto-Initialize macro, you don't need Randomize at all. That's because by default Daqarta starts with the Virtual Source active, and that uses the same random number generator to create noise. Without any automatic macro, the Virtual Source will generate an arbitrary number of samples before you hit a key to request a random value, so an unknown number (thousands) of random noise values will have been drawn already.


This uses the standard system "beeper" to produce tones of selected frequency and duration. The primary use of this is in macros that need to alert the operator at various phases of a test cycle, by providing a distinctive tone that is different from the error Alert.

Hit the *-key (SHIFT-8) to sound the tone. The default tone frequency is 440 Hz with a duration of 1/4 second.

To change the tone parameters, hit CTRL-8. (CTRL-SHIFT-8 will also work.) You will be prompted to enter the new User Tone frequency in Hz. Entry values will be internally limited to the system timer range of 18.2 Hz to 596 kHz, but fractional values within this range are allowed.

After you have entered the frequency, you will be prompted for the duration in seconds. This is converted internally to a number of cycles of the tone frequency, which must be an integer between 1 and 65536. Thus, for low tone frequencies, the actual duration can be set much longer than for high frequencies. Maximum durations:

    18.2 Hz     3600 sec  (1 hour)
    440 Hz      149 sec (2.48 min)
    20 kHz      3.28 sec
The operation of the User Tone depends on the setting of the error Alert. If Alert is set to Off, no User Tone will be produced. If Alert is set to Flash, the User Tone will likewise produce a flash instead of the selected tone.

You may wish to create macros that give a series of tones in a distinctive sequence. Best results will be obtained by using standard musical note frequencies.

You can use the random value entry system to get random tone frequencies, but they won't sound "musical" because they will include many frequencies that are "off-key".


Questions? Comments? Contact us!

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