IP2761 环路调节方法

  • 目的介绍
  • 依赖条件
  • 方法
  • 例子

目的介绍

在IP2761的应用设计中,需要针对不同的实际外围来做环路控制上的优化;常见用来解决纹波和啸叫问题。

依赖条件

IP2761 引用的目标板,最好有引出 TX & RX, 用于连接上位机来在线修改环路参数。

USB 转串口工具,用于连接电脑和目标板。

上位机程序,可以点 这里 下载

相关的固件:

使用方法

先连接USB 转串口工具和目标板上 IP2761 的 PIN12 & PIN13, 再将工具插上电脑,并打开上位机程序,此时应该能看到工具已经检测到了串口,或者你可以点击 “更新串口列表” ;如果你的电脑有多串口,请选择工具所对应的串口。

相关的串口命令部分的源代码:

    def 设定环路参数(self,ser,rGain_cc,rGain_cv,rfrq,rZero):
        command = []
        command.append("55")
        command.append("22")
        command.append(str(hex(rGain_cc))[2:].zfill(4)[2:])
        command.append(str(hex(rGain_cv))[2:].zfill(4)[2:])
        command.append(str(hex(rfrq))[2:].zfill(4)[2:])
        command.append(str(hex(rZero))[2:].zfill(4)[2:])
        command.append("AA")
        # print(command)
        for i in command:
            ser.write(bytes.fromhex(i))
        time.sleep(0.1)
        dataArray = ser.readall()
        try:
            print("+-------------------------+")
            print("|   分频:", int(dataArray[8]),"           |")
            print("|   零点:", int(dataArray[7]),"           |")
            print("|   恒压:", int(dataArray[6]),"           |")
            print("|   恒流:", int(dataArray[5]),"           |")
            print("+-------------------------+")
            self.电流环增益 = int(dataArray[5])
            self.电压环增益 = int(dataArray[6])
            self.零点电阻 = int(dataArray[7])
            self.分频系数 = int(dataArray[8])
        except:
            pass
        
    def 设定保护参数(self,ser,OVP,OCP):
        command = []
        command.append("55")
        command.append("33")
        command.append("00")
        command.append("00")
        command.append(str(hex(int( OCP / 50  )))[2:].zfill(4)[2:])
        command.append(str(hex(int( OVP / 100 )))[2:].zfill(4)[2:])
        command.append("AA")
        for i in command:
            ser.write(bytes.fromhex(i))
        time.sleep(0.1)
        dataArray = ser.readall()
        print(dataArray)
    
    def 设置输出电压电流(self, port, voltage, current):
        command = []
        command.append("55")
        command.append("11")
        if voltage > 0 and current > 0 and voltage and 40000 and current < 10000:
            command.append(str(hex(voltage))[2:].zfill(4)[:2])
            command.append(str(hex(voltage))[2:].zfill(4)[2:])
            command.append(str(hex(current))[2:].zfill(4)[:2])
            command.append(str(hex(current))[2:].zfill(4)[2:])
            command.append("AA")
            for i in command:
                port.write(bytes.fromhex(i))
            # time.sleep(0.1)
            # dataArray = port.readall()
            # print(dataArray)
            return True
        else:
            return False
IP2761 环路调节方法

One thought on “IP2761 环路调节方法

发表回复

Scroll to top