完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,希望有人可以帮助我。
我是E3631a的新手,我试图给E3631A上电并测量电流。 我的代码是在.Net 4中运行的C#。我似乎连接并且可以交互一些,但是我得到以下错误。错误查询:511,RS-232框架错误错误查询:-410,查询INTERRUPTEDI通过RS-232连接。仪表 设置为9600波特,无,8位。我的IO.OptionString当前为“Timeout = 2000; SendEndEnabled = TRUE; TerminationCharacter = 10; TerminationCharacterEnabled = TRUE; BaudRate = 9600; DataBits = 8; EndIn = ASRL_END_TERMCHAR; EndOut = ASRL_END_NONE; FlowControl = ASRL_FLOW_NONE; Parity = ASRL_PAR_NONE; RequestToSendState = 1; DataTerminalReadyState = 1; StopBits = ASRL_STOP_ONE; MaximumQueueLength = 1000; ReplacementCharacter = 255; XONCharacter = 17; XOFFCharacter = 19“我的代码如下。 跟踪输出遵循代码。 我的代码输出是System ReadyConnecting to the Power SupplyGetting Outputs设置电压水平1AgilentE36xx:检测到仪器错误。 使用ErrorQuery()来确定错误.Driver:Agilent.AgilentE36xx.Interop.AgilentE36xxClass,Initialized True ErrorQuery:511,RS-232 framing errorErrorQuery:-410,Query INTERRUPTEDErrorQuery:0,No errorDriver Closed void MeasureCurrentDraw(){ Agilent.AgilentE36xx.Interop.AgilentE36xx driver = null; try {// Create driver instance driver = new Agilent.AgilentE36xx.Interop.AgilentE36xx(); 记录(“连接电源”); string resourceDesc =“ASRL1 :: INSTR”; string standardInitOptions =“QueryInstrStatus = true”; string driverSetupOptions =“DriverSetup = Model =,Trace = true”; driver.Initialize(resourceDesc,true,true,standardInitOptions +“,”+ driverSetupOptions); if(driver.Initialized){driver.System.DisableLocalControls(); //获取Output1对象。 get_Name(1)返回“Output1”。 记录(“获取输出”); IAgilentE36xxOutput pOutput1 = driver.Outputs.get_Item(driver.Outputs.get_Name(1)); IAgilentE36xxOutput pOutput2 = driver.Outputs.get_Item(driver.Outputs.get_Name(2)); IAgilentE36xxOutput pOutput3 = driver.Outputs.get_Item(driver.Outputs.get_Name(3)); //设置输出电压。 记录(“设置电压等级1”); pOutput1.ApplyVurrentCurrent(5.2,2.8); 记录(“设置电压水平2”); pOutput2.ApplyVurrentCurrent(15,0.9); 记录(“设置电压等级3”); pOutput3.ApplyVoltageCurrent(-15,0.5); 记录(“启用输出”); //启用所有输出driver.Outputs.Enabled = true; 记录(“睡2秒”); Thread.sleep代码(2000); 记录(“测量电流消耗1”); //测量输出电压currentDraw [1] = pOutput1.Measure(AgilentE36xxMeasurementTypeEnum.AgilentE36xxMeasurementCurrent); 记录(“测量电流消耗2”); currentDraw [2] = pOutput1.Measure(AgilentE36xxMeasurementTypeEnum.AgilentE36xxMeasurementCurrent); 记录(“测量电流消耗3”); currentDraw [3] = pOutput1.Measure(AgilentE36xxMeasurementTypeEnum.AgilentE36xxMeasurementCurrent); 记录(“禁用输出”); //禁用所有输出driver.Outputs.Enabled = false; //检查仪器的错误int errorNum = -1; string errorMsg = null; while(errorNum!= 0){driver.Utility.ErrorQuery(ref errorNum,ref errorMsg); Log(String.Format(“ErrorQuery:{0},{1}”,errorNum,errorMsg)); driver.System.WaitForOperationComplete(1000); Thread.Sleep(2000); //睡眠2秒钟,让电压消失。 driver.System.EnableLocalControls(); } else {Log(“Driver failed to initialize”); catch(Exception ex){Log(ex.Message); //检查仪器是否有错误尝试{Log(String.Format(“Driver:{0},Initialized {1}”,driver,driver.Initialized)); if(driver!= null&& driver.Initialized){int errorNum = -1; string errorMsg = null; while(errorNum!= 0){driver.Utility.ErrorQuery(ref errorNum,ref errorMsg); Log(String.Format(“ErrorQuery:{0},{1}”,errorNum,errorMsg)); catch(Exception ex2){Log(“捕获异常时出错”); 日志(ex2.Message); } {finally(driver!= null&& driver.Initialized){//关闭驱动程序driver.Close(); 记录(“驱动程序已关闭”); }}} 以上来自于谷歌翻译 以下为原文 Hello, Hopefully someone can help me out. I am new to programming for the E3631a I am trying to power up my E3631A and measure the current draw. My code is C# running in .Net 4. I appear to connect and can interact some, but I get the following error. ErrorQuery: 511, RS-232 framing error ErrorQuery: -410, Query INTERRUPTED I am connected via RS-232. The meter is setup 9600 baud, none, 8 bits. My IO.OptionString is currently "Timeout = 2000 ; SendEndEnabled = TRUE ; TerminationCharacter = 10 ; TerminationCharacterEnabled = TRUE ; BaudRate = 9600 ; DataBits = 8 ; EndIn = ASRL_END_TERMCHAR ; EndOut = ASRL_END_NONE ; FlowControl = ASRL_FLOW_NONE ; Parity = ASRL_PAR_NONE ; RequestToSendState = 1 ; DataTerminalReadyState = 1 ; StopBits = ASRL_STOP_ONE ; MaximumQueueLength = 1000 ; ReplacementCharacter = 255 ; XONCharacter = 17 ; XOFFCharacter = 19" My code is as follows. The trace output follows the code. The output of my code is System Ready Connecting to the Power Supply Getting Outputs Setting voltage levels 1 AgilentE36xx: Instrument error detected. Use ErrorQuery() to determine the error(s). Driver: Agilent.AgilentE36xx.Interop.AgilentE36xxClass, Initialized True ErrorQuery: 511, RS-232 framing error ErrorQuery: -410, Query INTERRUPTED ErrorQuery: 0, No error Driver Closed void MeasureCurrentDraw() { Agilent.AgilentE36xx.Interop.AgilentE36xx driver = null; try { // Create driver instance driver = new Agilent.AgilentE36xx.Interop.AgilentE36xx(); Log("Connecting to the Power Supply"); string resourceDesc = "ASRL1::INSTR"; string standardInitOptions = "QueryInstrStatus=true"; string driverSetupOptions = "DriverSetup= Model=, Trace=true"; driver.Initialize(resourceDesc, true, true, standardInitOptions + "," + driverSetupOptions); if (driver.Initialized) { driver.System.DisableLocalControls(); // Get Output1 object. get_Name(1) returns "Output1". Log("Getting Outputs"); IAgilentE36xxOutput pOutput1 = driver.Outputs.get_Item(driver.Outputs.get_Name(1)); IAgilentE36xxOutput pOutput2 = driver.Outputs.get_Item(driver.Outputs.get_Name(2)); IAgilentE36xxOutput pOutput3 = driver.Outputs.get_Item(driver.Outputs.get_Name(3)); // Set output voltage. Log("Setting voltage levels 1"); pOutput1.ApplyVoltageCurrent(5.2, 2.8); Log("Setting voltage levels 2"); pOutput2.ApplyVoltageCurrent(15, 0.9); Log("Setting voltage levels 3"); pOutput3.ApplyVoltageCurrent(-15,0.5); Log("Enabling Outputs"); // Enable all outputs driver.Outputs.Enabled = true; Log("Sleeping for 2 seconds"); Thread.Sleep(2000); Log("Measuring the current draw 1"); // Measure the output voltage currentDraw[1] = pOutput1.Measure(AgilentE36xxMeasurementTypeEnum.AgilentE36xxMeasurementCurrent); Log("Measuring the current draw 2"); currentDraw[2] = pOutput1.Measure(AgilentE36xxMeasurementTypeEnum.AgilentE36xxMeasurementCurrent); Log("Measuring the current draw 3"); currentDraw[3] = pOutput1.Measure(AgilentE36xxMeasurementTypeEnum.AgilentE36xxMeasurementCurrent); Log("Disabling the outputs"); // Disable all outputs driver.Outputs.Enabled = false; // Check instrument for errors int errorNum = -1; string errorMsg = null; while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Log(String.Format("ErrorQuery: {0}, {1}", errorNum, errorMsg)); driver.System.WaitForOperationComplete(1000); } Thread.Sleep(2000); //Sleep for 2 seconds to allow voltages to die out. driver.System.EnableLocalControls(); } else { Log("Driver failed to initialize"); } } catch (Exception ex) { Log(ex.Message); // Check instrument for errors try { Log(String.Format("Driver: {0}, Initialized {1} ", driver, driver.Initialized)); if (driver != null && driver.Initialized) { int errorNum = -1; string errorMsg = null; while (errorNum != 0) { driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Log(String.Format("ErrorQuery: {0}, {1}", errorNum, errorMsg)); } } } catch (Exception ex2) { Log("error while catching exception"); Log(ex2.Message); } } finally { if (driver != null && driver.Initialized) { // Close driver driver.Close(); Log("Driver Closed"); } } } |
|
相关推荐
5个回答
|
|
我正在取得一些进展。
我正在使用安捷伦连接管理器,部分问题是我的电源设置不正确。 我需要将流量控制更改为DTR / DSR,将我的停止位更改为2.现在我设置如下波特率:9600数据大小:8流量控制:DTR / DSRAuto-discover:noStop位:2Parity:NONESQR行:RI(I' 我不确定这应该是什么,所以我把它保留为默认值。我得到的错误是在这行代码中pOutput1.ApplyVoltageCurrent(5.2,2.8); agilent IO Monitor向我显示:VISA:viWrite:APPL P6V, 5.2,2.8 nVISA:viWrite:* ESR? nVISA:viRead:............... VISA:viStatusDesc:VI_ERROR_TMO发生超时 以上来自于谷歌翻译 以下为原文 I am making some progress. I am using the agilent connection manager and part of my problem was my power supply was not setup correctly there. I needed to change the flow control to DTR/DSR and my stop bits to 2. Now I am setup as follows Baud rate: 9600 Data size: 8 Flow control: DTR/DSR Auto-discover: no Stop bits: 2 Parity: NONE SQR line: RI (I'm not sure what this should be, so I left it at the default) The error I am getting is during this line of code pOutput1.ApplyVoltageCurrent(5.2, 2.8); The agilent IO Monitor shows me: VISA:viWrite: APPL P6V,5.2,2.8n VISA:viWrite: *ESR?n VISA:viRead: ............... VISA:viStatusDesc: VI_ERROR_TMO A timeout occurred |
|
|
|
我无法使这种方法有效。
相反,我正在做以下事情。 Ivi.Visa.Interop.FormattedIO488 ioPS = null; 试试{ioPS = new FormattedIO488Class(); 记录(“测量电流消耗”); ResourceManager grm = new ResourceManager(); ioPS.IO =(IMessage)grm.Open(PowerSupplyConnectionString,AccessMode.NO_LOCK,2000,“”); ioPS.WriteString( “SYSTEM:REMOTE”); ioPS.WriteString( “* RST”); ioPS.WriteString( “* CLS”); ioPS.WriteString(“OUTPut OFF”); ioPS.WriteString(String.Format(“APPL P6V,{0},{1}”,SetVoltage [P6V],CurrentLimit [P6V])); ioPS.WriteString(String.Format(“APPL P25V,{0},{1}”,SetVoltage [P25V],CurrentLimit [P25V])); ioPS.WriteString(String.Format(“APPL n25V,{0},{1}”,SetVoltage [N25V],CurrentLimit [N25V])); 记录(“打开输出”); ioPS.WriteString(“OUTPut ON”); Thread.sleep代码(2000); ioPS.WriteString(“INST P6V”); Thread.sleep代码(750); ioPS.WriteString( “测量:电流”); currentDraw [P6V] =(double)ioPS.ReadNumber(); ioPS.WriteString(“INST P25V”); Thread.sleep代码(750); ioPS.WriteString( “测量:电流”); currentDraw [P25V] =(double)ioPS.ReadNumber(); ioPS.WriteString(“INST N25V”); Thread.sleep代码(750); ioPS.WriteString( “测量:电流”); currentDraw [N25V] =(double)ioPS.ReadNumber(); ioPS.WriteString(“OUTPut OFF”); 记录(“输出关闭”); ioPS.WriteString( “SYST:LOCAL”); ioPS.IO.Close(); } 以上来自于谷歌翻译 以下为原文 I was unable to get this method working. Instead I am doing the following. Ivi.Visa.Interop.FormattedIO488 ioPS = null ; try { ioPS = new FormattedIO488Class(); Log("Measuring Current Draw"); ResourceManager grm = new ResourceManager(); ioPS.IO = (IMessage)grm.Open(PowerSupplyConnectionString, AccessMode.NO_LOCK, 2000, ""); ioPS.WriteString("SYSTEM:REMOTE"); ioPS.WriteString("*RST"); ioPS.WriteString("*CLS"); ioPS.WriteString("OUTPut OFF"); ioPS.WriteString(String.Format("APPL P6V,{0},{1}", SetVoltage[P6V], CurrentLimit[P6V])); ioPS.WriteString(String.Format("APPL P25V,{0},{1}", SetVoltage[P25V], CurrentLimit[P25V])); ioPS.WriteString(String.Format("APPL n25V,{0},{1}", SetVoltage[N25V], CurrentLimit[N25V])); Log("Turning Output On"); ioPS.WriteString("OUTPut ON"); Thread.Sleep(2000); ioPS.WriteString("INST P6V"); Thread.Sleep(750); ioPS.WriteString("Meas:Current?"); currentDraw[P6V] = (double)ioPS.ReadNumber(); ioPS.WriteString("INST P25V"); Thread.Sleep(750); ioPS.WriteString("Meas:Current?"); currentDraw[P25V] = (double)ioPS.ReadNumber(); ioPS.WriteString("INST N25V"); Thread.Sleep(750); ioPS.WriteString("Meas:Current?"); currentDraw[N25V] = (double)ioPS.ReadNumber(); ioPS.WriteString("OUTPut OFF"); Log("Output Off"); ioPS.WriteString("SYST:LOCAL"); ioPS.IO.Close(); } |
|
|
|
从E3646A PS读取测量值时遇到同样的问题。
经过长时间的调查,我认为我发现了问题,唉它的解决方案需要修复安捷伦的驱动程序。 问题是命令measuredVolts = pOutput1.Measure(AgilentE36xxMeasurementTypeEnum.AgilentE36xxMeasurementVoltage); **向PS发送2个命令:1。写入INST:NSEL 1 2.查询MEAS:VOLT? 这些命令之间没有延迟,这就是为什么读取操作在TIMEOUT上失败的原因。 当你发送:ioPS.WriteString(“INST:NSEL 1”); Thread.sleep代码(750); ioPS.WriteString( “MEAS:CURR?”); curr_res_str = ioPS.ReadString(); 测量成功。 没有750毫秒的延迟它将无法正常工作!!!!!!!!! 亚历克斯 以上来自于谷歌翻译 以下为原文 I have the same problem reading measurements from my E3646A PS. After a lengthy investigation i think that I found the problem, alas it's solution needs to fix Agilent's driver. The problem is that the command measuredVolts = pOutput1.Measure(AgilentE36xxMeasurementTypeEnum.AgilentE36xxMeasurementVoltage);** sends 2 commands to the PS: 1. write INST:NSEL 1 2. query MEAS:VOLT? between these commands there's no delay and thats why the read operation fails on TIMEOUT. when you send : ioPS.WriteString("INST:NSEL 1"); Thread.Sleep(750); ioPS.WriteString("MEAS:CURR?"); curr_res_str = ioPS.ReadString(); The measurement is successful. without the 750mSec delay it won't work!!!!!!!!! Alex |
|
|
|
山川1998 发表于 2019-4-19 10:05 您好我一直试图通过RS232从Agilent E3634A获取电压和电流值,但我无法读取它们。 虽然我设置了所有值,但从仪器读取始终是个问题。 我在MainForm中将buffer clear定义为:byte [] clear = {0x03}; // ctrl-c命令 真的吗? serport.writeline(清晰,1,0); serport.writeline( “MEAS:VOLT?”); Thread.sleep代码(750); voltagevalue = serport.readExisting(); textbox.text = voltagevalue; 当我使用断点时,我会获得电压值。 但在跑步中,它会产生-103和-410个误差。 你在任何地方使用“* CLS”和“* OPC”命令吗? 我使用C#Visual作为IDE。 您的代码的一部分是否正常工作? 以上来自于谷歌翻译 以下为原文 Hello I have been trying to get voltage and current values from Agilent E3634A by RS232 but I can not read them. Although I set all values,reading from the instrument is always problem. I define buffer clear in MainForm as: byte[] clear = {0x03}; //ctrl-c command. is that true? serport.writeline(clear,1,0); serport.writeline("MEAS:VOLT?"); Thread.Sleep(750); voltagevalue = serport.readExisting(); textbox.text=voltagevalue; when I use break point, I optain voltage value. But in running, it gives -103 and -410errors. Do you use "*CLS" and "*OPC" commands anywhere? I use C#Visual as IDE. Do you have a part of your code that works properly? |
|
|
|
60user87 发表于 2019-4-19 10:22 您好,在进行测量之前,您不需要清除缓冲区。 我认为您需要在任何先前的命令和查询命令之间等待。 例如,如果你想打开输出然后测量电压:OUTP ON等待750 ms MEAS:VOLT? 读取价值 以上来自于谷歌翻译 以下为原文 Hello, You should not need to clear the buffer before doing a measurement. I think that you need a wait between any previous command and the query command. for instance if you want tot turn the output on and then measure the voltage: OUTP ON wait 750 ms MEAS:VOLT? read value |
|
|
|
只有小组成员才能发言,加入小组>>
1254 浏览 0 评论
2360 浏览 1 评论
2174 浏览 1 评论
2042 浏览 5 评论
2925 浏览 3 评论
1004浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
727浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
833浏览 0评论
1254浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-5 03:19 , Processed in 1.608284 second(s), Total 83, Slave 67 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号