Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
learn:instrumentation:tutorials:analog-discovery-studio-script-editor:start [2019/11/20 00:01] Arthur Brownlearn:instrumentation:tutorials:analog-discovery-studio-script-editor:start [2021/06/02 23:47] (current) Arthur Brown
Line 1: Line 1:
-====== Using the Script Editor ====== +====== Using the Script Editor  (REDIRECT) ====== 
- +~~REDIRECT>test-and-measurement/guides/waveforms-script-editor~~ 
-{{:reference:instrumentation:analog-discovery-studio:hardware-reference-manual:script-editor.png?nolink&800}} +~~NOSEMANTIC~~ 
- +{{tag>redirect}}
-===== Introduction ===== +
-This guide explains the use of the //Script Editor// instrument in WaveForms. This instrument is used to create and run scripts that can control all of the other instruments in WaveForms. +
----- +
-===== Prerequisites ===== +
-  * A Digilent Test & Measurement Device +
-  * A Computer with WaveForms Software Installed +
- +
----- +
-===== Guide ===== +
-==== 1. Opening the Script Editor ==== +
- +
-<WRAP group> +
-<WRAP column half> +
-=== 1.1 === +
-Plug in the Test & Measurement Device, then start WaveForms and make sure the device is connected. +
- +
-If no device is connected to the host computer when WaveForms launches, the **Device Manager** will be launched. Make sure that the device is plugged in and turned on, at which point it will appear in the Device Manager's device list (1.). Click on the device in the list to select it, then click the Select button (2.) to close the Device Manager. +
- +
-**Note:** //"DEMO" devices are also listed, which allow the user to use WaveForms and create projects without a physical device.// +
- +
-**Note:** //The Device Manager can be opened by clicking on the "Connected Device" button in the bottom right corner of the screen (3.), or by selecting "Device Manager" from the "Settings" menu at the top of the screen.// +
-</WRAP> +
-<WRAP column half> +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-oscilloscope:waveforms-device-manager.png?600 |}} +
-</WRAP> +
-</WRAP> +
----- +
-<WRAP group><WRAP column half> +
-=== 1.2 === +
-Once the Welcome page loads, in the instrument panel at the left side of the window, click on the **Script** button to open the //Script Editor// instrument. +
-</WRAP><WRAP column half> +
-{{ :learn:instrumentation:tutorials:waveforms-instrument-panel:waveforms-instrument-panel-script.png?nolink&600 |}} +
-</WRAP></WRAP> +
----- +
- +
-<WRAP group> +
-<WRAP column half> +
- +
-=== 1.3 === +
-When the //Script Editor// has opened, it will display the script editor (1), the output panel (2) below the editor, and the control toolbar (3) at the top. +
- +
-</WRAP> +
-<WRAP column half> +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-script-editor:script-callout.png?nolink&600 |}} +
-</WRAP> +
-</WRAP> +
- +
----- +
- +
-==== 2. Using the Script Editor ==== +
- +
-//This section walks through how to use the //Script Editor  +
- +
-<WRAP group> +
-<WRAP column half> +
- +
-=== 2.1 Hardware Setup === +
-To demonstrate the //Script Editor//, the //Scope// and //Wavegen// instruments will be used. +
- +
-First, connect the Test & Measurement scope channel 1 pin (orange wire) to the device's wavegen Channel 1 output pin (yellow wire). For devices that use differential input channels, make sure to connect the scope channel 1 negative pin (orange wire with white stripes) to the ground pin associated with wavegen channel 1 (black wire). +
- +
-</WRAP> +
-<WRAP column half> +
- +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-oscilloscope:scope-hw-setup.png?nolink&600 |}} +
- +
-</WRAP> +
-</WRAP> +
- +
----- +
- +
-<WRAP group> +
-<WRAP column half> +
- +
-=== 2.2 Software Setup ===  +
-For the //Script Editor// to make use of the instruments, they must be open in WaveForms. In WaveForms' Welcome tab, open the //Scope// instrument, then open the //Wavegen// instrument. +
- +
-</WRAP> +
-<WRAP column half> +
- +
-{{:learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-script-editor-instruments.png?600|}} +
- +
-</WRAP> +
-</WRAP> +
- +
----- +
- +
-<WRAP group> +
-<WRAP column half> +
- +
-=== 2.3 Running the Script === +
- +
-Return to the Scripts page by clicking on its tab in the bar at the top of the screen.  +
- +
-Upon launch, the Script editor contains an example script that controls the //Wavegen// and //Scope// instruments. +
- +
-Click the Run ({{:learn:instrumentation:tutorials:waveforms-buttons:waveforms-run.png?nolink}}) button to start running the example. +
- +
-Print statements and uncaught errors are shown in the output panel. +
- +
-</WRAP> +
-<WRAP column half> +
- +
-{{:learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-script-editor-output.png?600|}} +
- +
-</WRAP> +
-</WRAP> +
- +
-<WRAP group> +
-<WRAP column half> +
- +
-=== 2.4 Debugging === +
- +
-If in the process of writing a script, the script needs to be stepped through to find errors, the Script Editor's debugger can be used. +
- +
-Debugging is done inside WaveForms itself, allowing the user to step through the execution of the script. The debugger is accessed by clicking the Debug ({{:learn:instrumentation:tutorials:waveforms-buttons:waveforms-single.png?nolink}}) button, which will open a new window with the Qt debugger tool. +
- +
-</WRAP> +
-<WRAP column half> +
- +
-{{:learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-script-editor-debugger.png?600|}} +
- +
-</WRAP> +
-</WRAP> +
- +
----- +
- +
-==== 3. Script Editor User Interface Overview ==== +
-//This section walks through the different controls and features present in the //Script Editor. +
- +
-<WRAP group> +
-<WRAP column half> +
- +
-=== 3.1 The Control Toolbar === +
-The control toolbar contains menus and control interfaces used to configure the //Script Editor//, listed below: +
-  * //Debug//: Opens a QT Script Debugger window. +
-  * //Run//: Executes the script. +
-  * //Stop//: Stops debugging or execution of the script. For **Stop** to work, the code needs to use the //instrument//.wait() function. +
-  * //Abort//: Forces the execution to halt immediately. +
-  * //Zoom In// & //Zoom Out//; Used to increase or reduce the font size of the code editor respectively. +
-  * //Example//: contains a set of example scripts that use a variety of different instruments. +
-</WRAP> +
-<WRAP column half> +
- +
-{{:learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-script-editor-control.png?600|}} +
- +
-</WRAP> +
-</WRAP> +
----- +
-<WRAP group> +
-<WRAP column half> +
- +
-=== 3.2 The Menu Bar === +
- +
-**File** is used to open an existing WaveForms //Script Editor// project, save the current //Script Editor// project, or close the //Script Editor//.  +
- +
-</WRAP> +
-<WRAP column half> +
- +
-{{:learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-script-editor-file.png?600|}} +
- +
-</WRAP> +
-</WRAP> +
- +
-<WRAP group> +
-<WRAP column half> +
- +
-**Control** accesses the Debug, Run, Stop and Abort actions. +
- +
-</WRAP> +
-<WRAP column half> +
- +
-{{:learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-script-editor-control-drop.png?600|}} +
- +
-</WRAP> +
-</WRAP> +
- +
-<WRAP group> +
-<WRAP column half> +
- +
-**View** has options to enable the Output panel, code completion or add a plot panel. +
- +
-</WRAP> +
-<WRAP column half> +
- +
-{{:learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-script-editor-view.png?600|}} +
- +
-</WRAP> +
-</WRAP> +
----- +
-<WRAP group> +
-<WRAP column half> +
- +
-=== 3.3 The Script Editor === +
- +
-The Script Editor is an editor where the JavaScript code can be viewed and edited. +
- +
-</WRAP> +
-<WRAP column half> +
- +
-{{:learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-script-editor-editor-panel.png?600|}} +
- +
-</WRAP> +
-</WRAP> +
----- +
-<WRAP group> +
-<WRAP column half> +
- +
-=== 3.4 Output Panel === +
- +
-The output panel contains the results of print() statements and error messages. +
- +
-</WRAP> +
-<WRAP column half> +
- +
-{{:learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-script-editor-output-panel.png?600|}} +
- +
-</WRAP> +
-</WRAP> +
----- +
-<WRAP group> +
-<WRAP column half> +
-=== 3.5 WaveForms Help Tab === +
-Accessed via **Help** in the tab bar, the WaveForms Help Tab contains reference materials for all WaveForms instruments. +
- +
-Section 4, //"Code"//, of the Help tab's //"Script"// page documents the functions and objects that can be used in WaveForms scripts, the scripting API for WaveForms. +
- +
-</WRAP> +
-<WRAP column half> +
-{{ :learn:instrumentation:tutorials:analog-discovery-studio-script-editor:waveforms-scripts-help.png?nolink&600 |}} +
-</WRAP> +
-</WRAP> +
- +
-==== Next Steps ==== +
- +
-For more guides on how to use the Digilent Test & Measurement Device, return to the device's Resource Center, linked from [[reference:instrumentation:start|Instrumentation]] page of this wiki. +
- +
-For more information on WaveForms visit the [[reference:software:waveforms:waveforms-3:reference-manual|WaveForms Reference Manual]].  +
- +
-For technical support, please visit the [[https://forum.digilentinc.com/forum/8-scopes-instruments/|Scopes and Instruments]] section of the Digilent Forums. +
- +
-{{tag>analog-discovery-studio tutorial}}+