This is the demo scripts that accompany the iPhone App SCPI Commander. This page tries to explain how the scripts works. For a complete list of commands see Command reference or open help from the editor in the app.
To get the demo-scripts back you only need to delete the script you need back and force-quit the app and then restart it.
set a 78 set b "A string" + a 6 - a 4 * a 9 / a 5 disp @a disp @b
alertask ip "Adress" "Enter address" open @ip out *idn? in a disp @a close
speed 10 alertask ip ”Address” ”Enter address” open @ip *idn? in idn manuf man @idn model mod @idn serial ser @idn fw fw @idn ? "IDN String:\n\n" @idn "\n" ? "Model: " @mod ? ”Manufacturer: " @man ? "Serial: " @ser ? "FW: " @fw
// Ask for the address alertask ip "Address" "Enter address" open @ip *rst // Reset the instrument to default setting // Initiate the statistical array statinit // Measure 10 temperatures with 1 second between loop 10 1 ":meas:temp:tc? K,(@105)" // type-K termocouple at channel 105 in temp round temp stat+ @temp ? @temp wait 1000 next // Display the statistical ? "\nAverage:" @avg# ? "Median: " @med# ? "Standard deviation:" @stddev# // Save all statistical data savestat stat.csv 2
// Ask for the address alertask ip "Address" "Enter address" open @ip *rst // Reset the instrument to default setting // Initiate the statistical array statinit // Measure 10 temperatures with 1 second between loop 10 1 ":meas:temp:tc? K,(@105)" // type-K in temp round temp stat+ @temp & plotvar @temp "," plotcsv @plotvar ”Temperature” ? @temp wait 1000 next // Display the statistical ? "\nAverage:" @avg# ? "Median: " @med# ? "Standard deviation:" @stddev# // Save all statistical data savestat stat.csv 2
// Ask for the address alertask ip "Address" "Enter address" open @ip *rst // Reset the instrument to default setting // Initiate the statistical array statinit // Measure 10 temperatures with 1 second between loop 10 1 ":meas:temp? tc,k" // type-K termocouple in temp round temp stat+ @temp ? "Reading " @index ": " @temp " degree C" wait 1000 next // Display the statistical ? "\nAverage:" @avg# ? "Median: " @med# ? "Standard deviation:" @stddev# // Save all statistical data savestat stat.csv 2
// Ask for address and connect alertask ip "Address" "Enter address" open @ip // Setup to get the waveform ":wav;uns 1" ":wav:byt lsbf" ":wav:form word" ":wav:data?" // Get the waveform inb wf // Display the data ?b @wf // Save the waveform as bin file savebin @wf waveform.bin
speed 10 alertask ip ”Address” ”Enter address” open @ip ”:wav:form ascii” ”:wav:poin 10” :wav:data? in b ? @b newcsv waveform.csv addvarcsv @b closecsv
alertask ip "Address" "Enter address" open @ip *idn? in idn ":HARD:INK OFF" ":DISP:DATA? PNG, COLOR" wait 3000 inb b ?b @b 100 showpic @b @idn
alertask ip "Address" "Enter address" open @ip *idn? in id ":HCOP:SDUM:DATA:FORM JPG" :HCOP:SDUM:DATA? wait 3000 inb pic ?b @pic showpic @pic @id
speed 10 // increase execution speed // Ask for the address alertask ip "Address" "Enter address" open @ip // Get the binary block of waveform data ”:wav:form ascii” ”:wav:poin 500” :wav:data? wait 1000 inb binblock ?b @binblock // Draw the waveform plotcsvbin @binblock ”Waveform”
speed 10 // increase execution speed // Ask for the address alertask ip "Address" "Enter address" open @ip // Get the binary block of waveform data ”:wav:form byte” ”:wav:poin 900” :wav:data? wait 1000 inb binblock ?b @binblock // Get the Preample information so we can plot ”:wav:pre?” in pa ? @pa // Extract the values we need getcsvvalue yinc 7 @pa getcsvvalue yori 8 @pa getcsvvalue yref 9 @pa getcsvvalue datasize 0 @pa // Draw the waveform plotbin @binblock ”Waveform” @yori @yinc @yref @datasize
// This script show how to use byte order, by // asking for the word data size and LSBF speed 10 // increase execution speed // Ask for the address alertask ip "Address" "Enter address" open @ip // Get the binary block of waveform data ”:wav:form word” ”:wav:poin 900” // Ask for LSBF ":wav:byt lsbf" :wav:data? wait 1000 inb binblock ?b @binblock // Get the Preample information so we can plot ”:wav:pre?” in pa // Extract the values we need getcsvvalue yinc 7 @pa getcsvvalue yori 8 @pa getcsvvalue yref 9 @pa getcsvvalue datasize 0 @pa // Get the byteorder for word binary block ":wav:byt?" in bo byteorder @bo // Draw the waveform plotbin @binblock ”Waveform” @yori @yinc @yref @datasize
speed 10 // increase execution speed // Ask for the address alertask ip "Address" "Enter address" open @ip // Get the binary block of waveform data ”:wav:form byte” ”:wav:poin 900” :wav:data? wait 1000 inb binblock ?b @binblock // Get the Preample information so we can plot ”:wav:pre?” in pa ? @pa // Extract the values we need getcsvvalue yinc 7 @pa getcsvvalue yori 8 @pa getcsvvalue yref 9 @pa getcsvvalue datasize 0 @pa // Get values for scaling X-axis getcsvvalue xori 5 @pa getcsvvalue xinc 4 @pa getcsvvalue xref 6 @pa // We want to scale the x-axis, use us xaxis# @xori @xinc @xref 1000000 // Draw the waveform plotbin @binblock ”Waveform” @yori @yinc @yref @datasize
speed 10 // increase execution speed statinit // Initiate statistical array // Generate some statistical data loop 100 1 rnd a * a 10 int a stat+ @a next // Plot as a Bar Chart plotstatbar "Example Bar Chart" wait 5000 // wait 5 seconds // Plot as a Line Chart plotstatline "Example Line Chart"
speed 10 // increase execution speed statinit // Initiate statistical array clearchart // make sure we start with an empty chart // Generate some statistical data loop 100 1 rnd a * a 10 int a stat+ @a next // Plot as a Bar Chart plotstatbar "Example Bar Chart" wait 2000 // wait 2 seconds clearchart // Clear the current chart wait 2000 // Plot as a Line Chart plotstatline "Example Line Chart"
// Guess the number your phone thinks about // between 0 and 100 speed 0 set count 1 rnd number * number 100 int number label ask alertask guess "Guess" "Between 0 & 100" if= @guess @number Correct if< @guess @number Smal banner s e "Wrong!" alertok "Your guess" "Too Big!" + count 1 jmp Ask label Correct int count banner s s "Correct!" alertok "Your Guess" "Correct!!!\n\n" @count " Guesses" stop label Smal banner s e "Too Smal!" alertok "Your Guess" "To Smal!" + count 1 jmp Ask
// OnError Example ? ”Get the idenity” *idn? in idn ? @idn OnError ? ”Error occured” ? ”Error no” @errorno
speed 10 // Get the star timestamp set startt @timestamp // Display numbers 1 to 100 loop 100 1 ? @index next // Get the end timestamp set stopt @timestamp // Calculate how many seconds the loop took - stopt @startt ? \n @stopt ” - Seconds”
improve your online experience. Take a look at the Cookie Privacy to learn more and also my Privacy Policy. By pressing Dismiss I assume you are happy to allow the use of these cookies.
Made in RapidWeaver