Five Wire Automation using MBScript

The Five Wire GUI provides easy to understand interface for each of the five tools. It also allows you to save your complete setup or the setup of individual tools. However, for some applications automating the setup provides big advantages. Five Wire provides a ‘C’ like scripting language, MBScript, which allows you to take your tests to the next level. With MBScript you can:

  • Create custom digital and analog waveforms
  • Execute tests repeatedly, evaluating and storing results
  • Evaluate test results for application specific characteristics
  • Develop automated tests with user prompts

Each of the Five Wire tools includes a human readable command set. Scripts can use these commands to configure the tool and read back acquired data. For example, you can create a custom Waveform Source output by calculating the set of points that make up the waveform shape within a script. To execute the script just select File Run Script.

Here is an example script that creates a square wave by combining sine waves up to the 9th harmonic:

You can also create digital pattern sequences this way. For example, if you want to generate a series of random 8 bit values you can write a script with a for loop with the line value = rand(0, 255); and write that vector to the Logic Source using the library function LSvector(sequence, value, duration).

Capturing and evaluating data is just as easy. To start a Live Logic acquisition, include LL(“run”); in your script. To check that the acquisition is complete include if( !LLisStopped() ) sleep(100); . To retrieve the acquired data include data = LLgetWaveform(“CH1”, time[], data[]); which returns 2 arrays, one with the time of each sample and a second with the value sampled at that time. You can write for, while, and do-while loops to iterate over the data. Standard math and logic operations can be employed to search for the characteristic of interest. Results can be displayed in one of the easy to use dialog windows such as textWindow(value); or written to a text file.

MBScript looks very ‘C’ like. There are a few notable exceptions to this. Variables are not strongly typed; they are created automatically when encountered. Data arrays are associative not numeric. You can use a number index or a string to index the array. You can declare your own functions by inserting function funcName(param1, param2) {function body} .

The MBScript reference is included when the Five Wire application is installed. Just click Help Open MBScript Reference to open the PDF document. The reference includes a complete description of the script language, a description of the tool commands, and example scripts.