Section 6: Instrument programming
Models 707B and 708B Switching Matrix Reference Manual
6-14
707B-901-01 Rev. A / August 2010
Interactive script
An interactive script prompts the operator to input values using the instrument front panel. The
following example script uses display messages to prompt the operator to:
•
Enter the digital I/O line on which to output a trigger
•
Enter the output trigger pulsewidth
After the output trigger occurs, the front display displays a message to the operator.
When an input prompt is displayed, the script waits until the operator inputs the parameter or presses
the
ENTER
key.
-- Clear the display
display.clear()
-- Prompt user for digital I/O line on which to output trigger
myDigioLine = display.menu(
"Select digital output trigger line", "1 2 3 4 5 6 7 8 9 10")
-- Convert user input to a number
intMyDigioLine = tonumber(myDigioLine)
-- Prompt user for digital output trigger mode
myDigioEdge = display.menu(
"Select digital output trigger edge mode", "Rising Falling")
if myDigioEdge == "Rising" then
edgeMode = 2
else
edgeMode = 1
end
-- Prompt user for output trigger pulsewidth
myPulseWidth = display.prompt(
"000.0", "us", "Enter trigger pulsewidth", 10, 1, 100)
digio.trigger[intMyDigioLine].mode = edgeMode
digio.trigger[intMyDigioLine].pulsewidth = myPulseWidth
digio.trigger[intMyDigioLine].assert()
display.setcursor(1, 1)
-- Alert the user through the display that the output trigger
has occurred.
display.settext(
"Trigger asserted $Non digital I/O line " .. intMyDigioLine)
-- Wait five seconds and then return to main screen
delay(5)
display.screen = display.MAIN