Top Ten SCPI Programming Tips for Signal Generators - Rohde ...
Top Ten SCPI Programming Tips for Signal Generators - Rohde ...
Top Ten SCPI Programming Tips for Signal Generators - Rohde ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Miscellaneous <strong>Tips</strong><br />
10.4 Code Debugging<br />
If you need to debug your code, it is helpful to insert error queries at multiple positions<br />
in the code to quickly find the source of error (e.g. a wrongly spelled command). Also,<br />
send *OPC after each command – except <strong>for</strong> very time-consuming operations – and<br />
check if a “1” is returned (e.g. display the “1” on the screen <strong>for</strong> visual control).<br />
You can also use dedicated tools <strong>for</strong> debugging. For example, special debug features<br />
of your programming environment allow you to step through the individual code lines<br />
manually. These debugging tools can be used to identify <strong>SCPI</strong> commands in the code<br />
that produce an error on the instrument (e.g. because a level value that is too high has<br />
been sent to the instrument). Another debugging tool is the NI Spy tool from National<br />
Instruments; it allows you to see what in<strong>for</strong>mation is actually sent over the VISA<br />
interface. For example, this tool can be used to check if the <strong>SCPI</strong> command is indeed<br />
sent to the right instrument or accidentally to another instrument of the test setup. Also,<br />
codes often contain <strong>SCPI</strong> commands that contain values which are not predefined but<br />
are calculated during the run. These values are included in the <strong>SCPI</strong> command by<br />
means of e.g. %f in C codes or variables in MATLAB codes. Using NI Spy, you can<br />
check if the resulting <strong>SCPI</strong> command sent to the instrument is indeed what it is<br />
supposed to be or if, <strong>for</strong> example, spaces are missing or the calculated value is wrong<br />
(e.g. wrong dimension: Hz GHz).<br />
1GP79_1E <strong>Rohde</strong> & Schwarz <strong>Top</strong> <strong>Ten</strong> <strong>SCPI</strong> <strong>Programming</strong> <strong>Tips</strong> <strong>for</strong> <strong>Signal</strong> <strong>Generators</strong> 35