Pyvisa 电子负载驱动
<div class='showpostmsg'><p>厂商:Chroma</p><p>——————————————————————</p>
<p> 购买国产仪器器振兴民族工业</p>
<p>——————————————————————</p>
<p>型号:63600-2</p>
<p>Rev:1</p>
<p>驱动更新时间:2024/8/8</p>
<pre>
<code class="language-python">import pyvisa
class ChromaEload:
CmEload='None'
#设置默认地址将addres 内的内容修改为你自己的机器地址
def __init__(self,CmEload_addres='USB0::XXXXX::INSTR'):
rm = pyvisa.ResourceManager()
#连接示波器
ChromaEload.CmEload = rm.open_resource(CmEload_addres)
# 设置静态电流
def StaticCurrent(self,Current,Status=0):
# 设置为恒流模式
ChromaEload.CmEload.write('MODE CCM')
# 查询模式?
# print(ChromaEload.CmEload.query('MODE?'))
ChromaEload.CmEload.write('CURR:STAT:L1 '+str(Current))
#如果条件为1 或者输入str ON 就打开
if Status==1 or Status=='ON':
ChromaEload.CmEload.write('LOAD ON')
else:
ChromaEload.CmEload.write('LOAD OFF')
# ChromaEload.CmEload.close()
def DynamicCurrent(self, CurrentT1,CurrentT2,Status=0,repeat=10,period='5ms',rise=0.8):
# 设置为动态响应模式
ChromaEload.CmEload.write('MODE CCDM')
# 上升沿下降沿相等
ChromaEload.CmEload.write('CURR:DYN:RISE '+str(rise))
ChromaEload.CmEload.write('CURR:DYN:FALL '+str(rise))
ChromaEload.CmEload.write('CCUR:DYN:T1 '+period)
ChromaEload.CmEload.write('CCUR:DYN:T2 '+period)
ChromaEload.CmEload.write('CURR:DYN:REP '+ str(repeat))
# 设置电流 T1时间段
ChromaEload.CmEload.write('CURR:DYN:L1 ' + str(CurrentT1))
# 设置电流 T2时间段
ChromaEload.CmEload.write('CURR:DYN:L2 ' + str(CurrentT2))
# ChromaEload.CmEload.write('CURR:SWE:FEND 100')
if Status==1 or Status=='ON':
ChromaEload.CmEload.write('LOAD ON')
else:
ChromaEload.CmEload.write('LOAD OFF')
# 设置 最大电流 设置最小电流 关闭状态,占空比50% 频率100Hz 上升沿0.8A/us 持续时间0.2S
def CCSweep(self, Currmax, Currmin,Status=0,Duty=50,Freq=100,time_ON=2,Crise=0.8,Cfall=0.8):
if Status==1 or Status=='ON':
ChromaEload.CmEload.write('MODE CCFSM')
# 扫频停留时间
ChromaEload.CmEload.write('CURR:SWE:DWEL '+ str(time_ON))
# 查询设置
print(ChromaEload.CmEload.query('CURR:SWE:DWEL?'))
# 设置占空比
ChromaEload.CmEload.write('CURR:SWE:DUTY ' + str(Duty))
# 设置频率
# ChromaEload.CmEload.write('CURR:SWE:FEND ' + str(Freq))
ChromaEload.CmEload.write('CURR:SWE:FSTA ' + str(Freq))
ChromaEload.CmEload.write('CURR:SWE:IMAX ' + str(Currmax))
ChromaEload.CmEload.write('CURR:SWE:IMIN ' + str(Currmin))
# 上升沿下降沿都是0.8A
ChromaEload.CmEload.write('CURR:SWE:RISE 0.8'+str(Crise))
ChromaEload.CmEload.write('CURR:SWE:FALL 0.8'+str(Cfall))
ChromaEload.CmEload.write('LOAD ON')
else:
ChromaEload.CmEload.write('LOAD OFF')</code></pre>
<p> </p>
</div><script> var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;" style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
if(parseInt(discuz_uid)==0){
(function($){
var postHeight = getTextHeight(400);
$(".showpostmsg").html($(".showpostmsg").html());
$(".showpostmsg").after(loginstr);
$(".showpostmsg").css({height:postHeight,overflow:"hidden"});
})(jQuery);
} </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script> <p>后面要是写了其他的电子负载驱动我也会更新上来</p>
页:
[1]