Wilson, Pete
2015-05-15 22:12:35 UTC
Greetings I am trying to write a test executive program using python 2.7 on a windows 7 computer. I want to connect to a Keithley 2100 voltmeter using National Instruments VISA. I am having trouble installing pyvisa. All the documentation refers to using 'pip' and a command line "$ pip install pyvisa" . What interface or console is this? "$" prompt looks like a Linux command line. How do we do this with windows?
Do I have to do this? Or can I use the native visa module in Python 2.7? Using the help() and dir() features I can get some basic information about visa, but the functions have changed, like visa.ResourceManager.open_resource is not working. I really liked this function... Are there any examples of how to use this new visa? I have some working code below that uses pyvisa, can it be converted?
def update_current():
import visa
rm = visa.ResourceManager()
rm.list_resources()
current_1_ma = ""
exe_check = "PASS"
try:
dut_data = open("dut_data.txt", "w")
except:
exe_check = "FAIL"
try:
ki2100 = rm.open_resource('USB0::0x05E6::0x2100::1148525::INSTR')
device_id = ki2100.query("*IDN?")
except:
exe_check = "FAIL"
try:
dut_current_amps = (float(ki2100.query("MEASure:CURRent:DC?")))
dut_current_ma = dut_current_amps * 1000.0
current_1_ma = "%6G" % dut_current_ma
except:
exe_check = "FAIL"
new_line = "Litepoint_Data_Format" + "\r\n"
dut_data.write(new_line)
new_line = "CURRENT_1_MA=" + current_1_ma + "\r\n"
dut_data.write(new_line)
new_line = "EXE_CHECK=" + exe_check + "\r\n"
dut_data.write(new_line)
dut_data.close()
return
if __name__ == "__main__":
update_current()
print "Dumping dut_data.txt"
with open('dut_data.txt') as dut_data:
for line in dut_data:
print line,
if 'str' in line:
break
dut_data.close()
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Do I have to do this? Or can I use the native visa module in Python 2.7? Using the help() and dir() features I can get some basic information about visa, but the functions have changed, like visa.ResourceManager.open_resource is not working. I really liked this function... Are there any examples of how to use this new visa? I have some working code below that uses pyvisa, can it be converted?
def update_current():
import visa
rm = visa.ResourceManager()
rm.list_resources()
current_1_ma = ""
exe_check = "PASS"
try:
dut_data = open("dut_data.txt", "w")
except:
exe_check = "FAIL"
try:
ki2100 = rm.open_resource('USB0::0x05E6::0x2100::1148525::INSTR')
device_id = ki2100.query("*IDN?")
except:
exe_check = "FAIL"
try:
dut_current_amps = (float(ki2100.query("MEASure:CURRent:DC?")))
dut_current_ma = dut_current_amps * 1000.0
current_1_ma = "%6G" % dut_current_ma
except:
exe_check = "FAIL"
new_line = "Litepoint_Data_Format" + "\r\n"
dut_data.write(new_line)
new_line = "CURRENT_1_MA=" + current_1_ma + "\r\n"
dut_data.write(new_line)
new_line = "EXE_CHECK=" + exe_check + "\r\n"
dut_data.write(new_line)
dut_data.close()
return
if __name__ == "__main__":
update_current()
print "Dumping dut_data.txt"
with open('dut_data.txt') as dut_data:
for line in dut_data:
print line,
if 'str' in line:
break
dut_data.close()
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor