我打算使用Kikusui设备USB-TP PIA4850控制电源(来自Kikusui)。我使用Ivi.Visa.Interop库。以下是我可以通过设置所需电压成功控制电源的代码。
(链接至编程指南:https://www.kikusui.co.jp/kiku_manuals/P/PIA4800/english/index.html)
(链接至操作手册:https://www.kikusui.co.jp/kiku_manuals/P/PIA4850_E5.pdf)
Using Ivi.Visa.Interop;
namespace USBTPTest
{
class USBTPController
{
private IResourceManager3 rm = new ResourceManager();
private IMessage iMessage;
public USBTPController() //to get the address of the device connected and open the address if found
{
string[] adrsList = rm.FindRsrc("?*");
if (adrsList.Count() != 0)
{
Open(adrsList[0]);
}
}
public bool Open(string str)
{
string addr = str;
iMessage = (IMessage)rm.Open(addr, AccessMode.NO_LOCK, 0, "");
//iMessage.WriteString("TRM 2");
iMessage.WriteString("NODE 5");
iMessage.WriteString("CH 1");
iMessage.WriteString("REM 1");
bOpened = true;
return true;
}
public bool SetVoltage(float vol) {} //method to set the desired voltage to the power supply, when called with an appropriate argument
通过万用表在电源端子上检查设置电压。类似地,电流也被设置和检查。到这里,代码将运行并给出预期的结果。
public string ReadVOut()
{
iMessage.WriteString("VOUT?"); //Query OUT(ON/OFF) measurement value
string VOutStatus;
VOutStatus = iMessage.ReadString(1024); //Read from PIA
return VOutStatus;
}
public string ReadIOut()
{
iMessage.WriteString("IOUT?"); //Query OUT(ON/OFF) measurement value
string COutStatus;
COutStatus = iMessage.ReadString(1024); //Read from PIA
return COutStatus;
}
}
}
当我读取输出的电压/电流值时出现问题。尽管我能够正确读取值,但有时使用ReadVOut()读取电压会产生电流,反之亦然。我无法弄清楚是否是代码或我连接的电源故障或其他原因。并非常感谢您的帮助/想法/线索。