資源簡介
Python 控制ITECH IT6302 POWER SUPPLY示例代碼。親自編寫,實際測試可用。
代碼片段和文件信息
import?serial
import?binascii
import?os
import?time
#?常用命令
power_supply_port?=?‘COM9‘
#?system
get_id?=?‘*idn?\n‘
set_remote_ctrl?=?‘SYST:REM\n‘
get_sys_version?=?‘SYST:VERS?\n‘
#?ch?control
select_ch1?=?‘INST?FIRst\n‘
select_ch2?=?‘INST?SECOnd\n‘
select_ch3?=?‘INST?THIrd\n‘
get_select_ch?=?‘INST?\n‘??#?return?CH1?CH2?or?CH3
get_output_status?=?‘OUTP?\n‘?#?return?1?or?0?
open_select_ch?=?‘OUTP?1\n‘
close_select_ch?=?‘OUTP?0\n‘
close_all_ch?=?‘APP:OUT?OFFOFFOFF\n‘
get_voltage?=?‘VOLT?\n‘
get__max_voltage?=?‘VOLT:PROT?\n‘
#?change?when?need
set_voltage?=?‘VOLT?3.3V\n‘?#?unit?V?mV?uV?kV
set_max_voltage?=?‘VOLT:PROT?5V\n‘?#?unit?V?mV?uV?kV
get_current?=?‘MEAS:CURR?\n‘??#unit?A?;exampl:0.00121514
class?PowerSupplyCtrl:????
????def?__init__(self?com_port):
????????self.com?=?com_port
????????self.send_cmd(set_remote_ctrl)
????????self.send_cmd(set_remote_ctrl)?????
????????self.send_cmd(get_id)
????????print(self.get_cmd_return())
????????self.send_cmd(get_sys_version)
????????print(self.get_cmd_return())
????????self.send_cmd(close_all_ch)????
????def?sen
評論
共有 條評論