Reputation: 13
I am trying to control a KEITHLEY 2612A SourceMeter using labview. I have installed the appropriate drivers and I managed to connect to the instrument using VISA. Currently I am just experimenting with the scripting language, which the instrument uses.
Is it possible to use a Numeric Controller - a Knob for example - and use its value in the script to be loaded to the instrument? I don't have enough reputation points to add images.
EDIT
ON = 1
OFF = 0
function hello()
display.clear()
display.setcursor (1,7)
display.settext ("DONE :)")
end
smub.reset()
smub.source.output = ON
--Set the measurement integration time
smub.measure.nplc = 1
smub.measure.delay = 0.05
--Configure the reading buffers
smub.nvbuffer1.clear()
smub.nvbuffer1.appendmode = 1
smub.nvbuffer1.collecttimestamps = 1
smub.nvbuffer1.collectsourcevalues = 0
smub.nvbuffer1.fillmode = smub.FILL_ONCE
for i = 0, 0.5, 0.01 do
smub.source.levelv = i
reading = smub.measure.i (smub.nvbuffer1)
end
delay(5)
hello()
smub.source.output = OFF
delay(1)
display.clear()
display.setcursor(1,1)
display.settext(string.format("%g", smub.nvbuffer1[1]))
delay(5)
display.clear()
display.settext(string.format("%g", smub.nvbuffer1[50]))
Block diagram: https://i.sstatic.net/siZAa.png Front panel: https://i.sstatic.net/A9MVF.png
Upvotes: 0
Views: 507
Reputation: 1986
LabVIEW has standard string manipulation primitives, and you can accomplish your goal by using string substitution: place a sentinel string in your script and replace it with the value from the knob.
Here, I've used __BUFFER_NUMBER__
as a unique string in the Script Format input terminal. LabVIEW searches for that string and replaces it with the knob's current value.
Upvotes: 2
Reputation: 1070
You add the knob control, wire the value to the number-to-string VI (http://zone.ni.com/reference/en-XX/help/371361M-01/glang/number_to_fract_string/ ), and wire that to the "Search and replace string VI" (http://zone.ni.com/reference/en-XX/help/371361M-01/glang/search_and_replace_string/) you search for the value in the script that you want to replace.
Upvotes: 0