完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我正在使用Agilent ENA5061B网络分析仪。
我正在使用从PC到ENA的远程GPIB-USB-B连接,我使用Visual C ++将它们连接起来。 一切正常,我能够测量我的S11数据并将其写入ENA硬盘D:驱动器上的.csv文件。 我需要为我的项目做两件事:1)测量完成后,将.csv文件从ENA直接写到我的电脑上。 2)将写在ENA硬盘上的.csv文件传输到我的PC。 任何人都可以帮我一个VC ++代码,可以做到这一点? 我可以将代码附加到我的代码中。 提前致谢。 以上来自于谷歌翻译 以下为原文 Hi, I am using the Agilent ENA5061B Network analyzer. I am using a remote GPIB-USB-B connection from my PC to ENA and I am using Visual C++ to connect them both. Everything works fine and I am able to measure my S11 data and write it into a .csv file on the ENA's hardisk D: drive. I need to be able to do two things for my project: 1) Write the .csv file directly onto my PC from the ENA when the measurement is done. 2) Transfer the .csv file written on the ENA's hardrive to my PC. Can anyone help me with a VC++ code which can do this? I can append the code to mine. Thanks in advance. |
|
相关推荐
9个回答
|
|
我已经开始尝试使用:MMEM:TRAN和:MMEM:COPY但它似乎不起作用。
它看起来像这样://测量viWrite(vi,(ViBuf)“:CALC1:PAR1:DEF S11 n”,20,& retcnt); //存储测量数据viWrite(vi,(ViBuf)“:MMEM:STOR:FDAT'ramtry.csv' n”,33,& retcnt); viWrite(vi,(ViBuf)“:MMEM:COPY'ramism.csv','C: ram1.csv' n”,38,& retcnt); / *关闭会话* / viClose(vi); viClose(defaultRM); 以上来自于谷歌翻译 以下为原文 I have already gone ahead and tried using :MMEM:TRAN and :MMEM:COPY but it does not seem to work. It looks like this: //Measurement viWrite(vi,(ViBuf)":CALC1:PAR1:DEF S11n",20, &retcnt); //Storing measurement data viWrite(vi,(ViBuf)":MMEM:STOR:FDAT 'ramtry.csv'n",33, &retcnt); viWrite(vi, (ViBuf)":MMEM:COPY 'ramtry.csv','C:ram1.csv'n",38,&retcnt); /* Close session */ viClose (vi); viClose (defaultRM); |
|
|
|
hfjydz2013 发表于 2018-12-12 08:20 嗨,我有一个例子来转储图像文件并从PNA复制它,ENA的命令非常相似。 FileStream output = new FileStream(filePath,FileMode.Create); BinaryWriter writer = new BinaryWriter(output); string str6 = @“C: tmppnascreen.png”; string str =“DISP:ANN:MESS:STAT OFF”; ioDmm.WriteString(STR); str =“HCOP:FILE ”“+ str6 +”“”; //从PNA转储图像,您应该更改代码以将数据文件保存到ENA ioDmm.WriteString(str); OPC(); str =“MMEM:TRAN?”“+ str6 +”“”; ioDmm.WriteString(STR); string str5 = ioDmm.IO.ReadString(1); int count = Convert.ToInt32(ioDmm.IO.ReadString(1)); int num2 = Convert.ToInt32(ioDmm.IO.ReadString(count)); byte [] buffer = new byte [num2 + 1]; buffer =(byte [])ioDmm.IO.Read(num2); writer.Write(缓冲液); writer.Close(); output.Close(); str =“DISP:ANN:MESS:STAT ON”; ioDmm.WriteString(STR); 以上来自于谷歌翻译 以下为原文 Hi, I have an example to dump image file and copy it from the PNA, the command for ENA is very similar. FileStream output = new FileStream(filePath, FileMode.Create); BinaryWriter writer = new BinaryWriter(output); string str6 = @"C:tmppnascreen.png"; string str = "DISP:ANN:MESS:STAT OFF"; ioDmm.WriteString(str); str = "HCOP:FILE "" + str6 + """; //dump image from PNA, you should change your code to save the data file to ENA ioDmm.WriteString(str); OPC(); str = "MMEM:TRAN? "" + str6 + """; ioDmm.WriteString(str); string str5 = ioDmm.IO.ReadString(1); int count = Convert.ToInt32(ioDmm.IO.ReadString(1)); int num2 = Convert.ToInt32(ioDmm.IO.ReadString(count)); byte[] buffer = new byte[num2 + 1]; buffer = (byte[])ioDmm.IO.Read(num2); writer.Write(buffer); writer.Close(); output.Close(); str = "DISP:ANN:MESS:STAT ON"; ioDmm.WriteString(str); |
|
|
|
平凡的世界12 发表于 2018-12-12 08:40 Hi Ningchen, Thank you for the help. When I run your code what changes do I probably have to make because it says the following errors. Is there like a separate function named 'Filestream' and 'Binarywriter' that you wrote which it is referrring to? If so can you add that as well? Thanks in advance. Cheers Ram gpibinternew.cpp(136): error C2065: 'FileStream' : undeclared identifier 1>gpibinternew.cpp(136): error C2146: syntax error : missing ';' before identifier 'output' 1>gpibinternew.cpp(136): error C2065: 'output' : undeclared identifier 1>gpibinternew.cpp(136): error C2061: syntax error : identifier 'FileStream' 1>gpibinternew.cpp(137): error C2065: 'BinaryWriter' : undeclared identifier 1>gpibinternew.cpp(138): error C2065: 'string' : undeclared identifier 1>gpibinternew.cpp(138): error C2146: syntax error : missing ';' before identifier 'str6' 1>gpibinternew.cpp(138): error C2065: 'str6' : undeclared identifier 1>gpibinternew.cpp(138): error C2018: unknown character '0x40' 1>gpibinternew.cpp(138): warning C4129: 'h' : unrecognized character escape sequence 1>gpibinternew.cpp(139): error C2065: 'string' : undeclared identifier 1>gpibinternew.cpp(139): error C2146: syntax error : missing ';' before identifier 'str' 1>gpibinternew.cpp(139): error C2065: 'str' : undeclared identifier 1>gpibinternew.cpp(140): error C2065: 'ioDmm' : undeclared identifier 1>gpibinternew.cpp(140): error C2228: left of '.WriteString' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(140): error C2065: 'str' : undeclared identifier 1>gpibinternew.cpp(142): error C2065: 'str' : undeclared identifier 1>gpibinternew.cpp(142): error C2065: 'str6' : undeclared identifier 1>gpibinternew.cpp(143): error C2065: 'ioDmm' : undeclared identifier 1>gpibinternew.cpp(143): error C2228: left of '.WriteString' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(143): error C2065: 'str' : undeclared identifier 1>gpibinternew.cpp(145): error C3861: 'OPC': identifier not found 1>gpibinternew.cpp(147): error C2065: 'str' : undeclared identifier 1>gpibinternew.cpp(147): error C2065: 'str6' : undeclared identifier 1>gpibinternew.cpp(148): error C2065: 'ioDmm' : undeclared identifier 1>gpibinternew.cpp(148): error C2228: left of '.WriteString' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(148): error C2065: 'str' : undeclared identifier 1>gpibinternew.cpp(150): error C2065: 'string' : undeclared identifier 1>gpibinternew.cpp(150): error C2146: syntax error : missing ';' before identifier 'str5' 1>gpibinternew.cpp(150): error C2065: 'str5' : undeclared identifier 1>gpibinternew.cpp(150): error C2065: 'ioDmm' : undeclared identifier 1>gpibinternew.cpp(150): error C2228: left of '.IO' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(150): error C2228: left of '.ReadString' must have class/struct/union 1>gpibinternew.cpp(151): error C2065: 'Convert' : undeclared identifier 1>gpibinternew.cpp(151): error C2228: left of '.ToInt32' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(151): error C2065: 'ioDmm' : undeclared identifier 1>gpibinternew.cpp(151): error C2228: left of '.IO' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(151): error C2228: left of '.ReadString' must have class/struct/union 1>gpibinternew.cpp(152): error C2065: 'Convert' : undeclared identifier 1>gpibinternew.cpp(152): error C2228: left of '.ToInt32' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(152): error C2065: 'ioDmm' : undeclared identifier 1>gpibinternew.cpp(152): error C2228: left of '.IO' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(152): error C2228: left of '.ReadString' must have class/struct/union 1>gpibinternew.cpp(153): error C2065: 'byte' : undeclared identifier 1>gpibinternew.cpp(153): error C2059: syntax error : ']' 1>gpibinternew.cpp(154): error C2065: 'buffer' : undeclared identifier 1>gpibinternew.cpp(154): error C2065: 'byte' : undeclared identifier 1>gpibinternew.cpp(154): error C2059: syntax error : ']' 1>gpibinternew.cpp(155): error C2065: 'writer' : undeclared identifier 1>gpibinternew.cpp(155): error C2228: left of '.Write' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(155): error C2065: 'buffer' : undeclared identifier 1>gpibinternew.cpp(156): error C2065: 'writer' : undeclared identifier 1>gpibinternew.cpp(156): error C2228: left of '.Close' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(157): error C2065: 'output' : undeclared identifier 1>gpibinternew.cpp(157): error C2228: left of '.Close' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(158): error C2065: 'str' : undeclared identifier 1>gpibinternew.cpp(159): error C2065: 'ioDmm' : undeclared identifier 1>gpibinternew.cpp(159): error C2228: left of '.WriteString' must have class/struct/union 1> type is ''unknown-type'' 1>gpibinternew.cpp(159): error C2065: 'str' : undeclared identifier ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== |
|
|
|
hfjydz2013 发表于 2018-12-12 08:45 嗨,代码在C#中。 您可以在C#控制台应用程序中尝试它。 之后您可能需要将其转换为C ++。 以上来自于谷歌翻译 以下为原文 Hi, the code is in C#. You can try it in C# console application. You may need to translate it to C++ after that. |
|
|
|
hfjydz2013 发表于 2018-12-12 08:45 我不擅长C ++,我花了两个小时来搞清楚。 以下是您需要的代码:ptr-> WriteString(“:MMEM:STOR:FDAT'D:ramtry.csv'; * opc? n”); ptr-> WriteString(“MMEM:TRAN?'D:ramtry.csv'; * opc? n”); _bstr_t str1 = ptr-> ReadString(1); _bstr_t str2 = ptr-> ReadString(1); int count = atoi(str2); int num2 = atoi(ptr-> ReadString(count)); _bstr_t result = ptr-> ReadString(num2); CString strResult =(CString)result.GetBSTR(); ofstream文件; file.open(“C: ramtry.csv”,ios :: out); if(file.is_open()){file} file.close();编辑:ningchen于2014年7月10日下午9:15 以上来自于谷歌翻译 以下为原文 I'm not good at C++, it takes me two hours to figure it out. Here is the code you need: ptr->WriteString(":MMEM:STOR:FDAT 'D:ramtry.csv';*opc?n"); ptr->WriteString("MMEM:TRAN? 'D:ramtry.csv';*opc?n"); _bstr_t str1 = ptr->ReadString(1); _bstr_t str2 = ptr->ReadString(1); int count = atoi(str2); int num2 = atoi(ptr->ReadString(count)); _bstr_t result = ptr->ReadString(num2); CString strResult = (CString)result.GetBSTR(); ofstream file; file.open("C:ramtry.csv", ios::out); if(file.is_open()) { file << strResult; } file.close(); Edited by: ningchen on Jul 10, 2014 9:15 PM |
|
|
|
hfjydz2013 发表于 2018-12-12 08:45 我不擅长C ++,我花了两个小时来搞清楚。 以下是您需要的代码:ptr-> WriteString(“:MMEM:STOR:FDAT'D:ramtry.csv'; * opc? n”); ptr-> WriteString(“MMEM:TRAN?'D:ramtry.csv'; * opc? n”); _bstr_t str1 = ptr-> ReadString(1); _bstr_t str2 = ptr-> ReadString(1); int count = atoi(str2); int num2 = atoi(ptr-> ReadString(count)); _bstr_t result = ptr-> ReadString(num2); CString strResult =(CString)result.GetBSTR(); ofstream文件; file.open(“C: ramtry.csv”,ios :: out); if(file.is_open()){file} file.close(); 以上来自于谷歌翻译 以下为原文 I'm not good at C++, it takes me two hours to figure it out. Here is the code you need: ptr->WriteString(":MMEM:STOR:FDAT 'D:ramtry.csv';*opc?n"); ptr->WriteString("MMEM:TRAN? 'D:ramtry.csv';*opc?n"); _bstr_t str1 = ptr->ReadString(1); _bstr_t str2 = ptr->ReadString(1); int count = atoi(str2); int num2 = atoi(ptr->ReadString(count)); _bstr_t result = ptr->ReadString(num2); CString strResult = (CString)result.GetBSTR(); ofstream file; file.open("C:ramtry.csv", ios::out); if(file.is_open()) { file << strResult; } file.close(); |
|
|
|
hfjydz2013 发表于 2018-12-12 08:45 我不擅长C ++,我花了两个小时来搞清楚。 以下是您需要的代码:ptr-> WriteString(“:MMEM:STOR:FDAT'D:ramtry.csv'; * opc? n”); ptr-> WriteString(“MMEM:TRAN?'D:ramtry.csv'; * opc? n”); _bstr_t str1 = ptr-> ReadString(1); _bstr_t str2 = ptr-> ReadString(1); int count = atoi(str2); int num2 = atoi(ptr-> ReadString(count)); _bstr_t result = ptr-> ReadString(num2); CString strResult =(CString)result.GetBSTR(); ofstream文件; file.open(“C: ramtry.csv”,ios :: out); if(file.is_open()){file} file.close(); 以上来自于谷歌翻译 以下为原文 I'm not good at C++, it takes me two hours to figure it out. Here is the code you need: ptr->WriteString(":MMEM:STOR:FDAT 'D:ramtry.csv';*opc?n"); ptr->WriteString("MMEM:TRAN? 'D:ramtry.csv';*opc?n"); _bstr_t str1 = ptr->ReadString(1); _bstr_t str2 = ptr->ReadString(1); int count = atoi(str2); int num2 = atoi(ptr->ReadString(count)); _bstr_t result = ptr->ReadString(num2); CString strResult = (CString)result.GetBSTR(); ofstream file; file.open("C:ramtry.csv", ios::out); if(file.is_open()) { file << strResult; } file.close(); |
|
|
|
hfjydz2013 发表于 2018-12-12 08:45 我不擅长C ++,我花了两个小时来搞清楚。 以下是您需要的代码:ptr-> WriteString(“:MMEM:STOR:FDAT'D:ramtry.csv'; * opc? n”); ptr-> WriteString(“MMEM:TRAN?'D:ramtry.csv'; * opc? n”); _bstr_t str1 = ptr-> ReadString(1); _bstr_t str2 = ptr-> ReadString(1); int count = atoi(str2); int num2 = atoi(ptr-> ReadString(count)); _bstr_t result = ptr-> ReadString(num2); CString strResult =(CString)result.GetBSTR(); ofstream文件; file.open(“C: ramtry.csv”,ios :: out); if(file.is_open()){file} file.close(); 以上来自于谷歌翻译 以下为原文 I'm not good at C++, it takes me two hours to figure it out. Here is the code you need: ptr->WriteString(":MMEM:STOR:FDAT 'D:ramtry.csv';*opc?n"); ptr->WriteString("MMEM:TRAN? 'D:ramtry.csv';*opc?n"); _bstr_t str1 = ptr->ReadString(1); _bstr_t str2 = ptr->ReadString(1); int count = atoi(str2); int num2 = atoi(ptr->ReadString(count)); _bstr_t result = ptr->ReadString(num2); CString strResult = (CString)result.GetBSTR(); ofstream file; file.open("C:ramtry.csv", ios::out); if(file.is_open()) { file << strResult; } file.close(); |
|
|
|
hfjydz2013 发表于 2018-12-12 08:20 我不擅长C ++,我花了两个小时来搞清楚。 以下是您需要的代码:ptr-> WriteString(“:MMEM:STOR:FDAT'D:ramtry.csv'; * opc? n”); ptr-> WriteString(“MMEM:TRAN?'D:ramtry.csv'; * opc? n”); _bstr_t str1 = ptr-> ReadString(1); _bstr_t str2 = ptr-> ReadString(1); int count = atoi(str2); int num2 = atoi(ptr-> ReadString(count)); _bstr_t result = ptr-> ReadString(num2); CString strResult =(CString)result.GetBSTR(); ofstream文件; file.open(“C: ramtry.csv”,ios :: out); if(file.is_open()){file} file.close(); 以上来自于谷歌翻译 以下为原文 I'm not good at C++, it takes me two hours to figure it out. Here is the code you need: ptr->WriteString(":MMEM:STOR:FDAT 'D:ramtry.csv';*opc?n"); ptr->WriteString("MMEM:TRAN? 'D:ramtry.csv';*opc?n"); _bstr_t str1 = ptr->ReadString(1); _bstr_t str2 = ptr->ReadString(1); int count = atoi(str2); int num2 = atoi(ptr->ReadString(count)); _bstr_t result = ptr->ReadString(num2); CString strResult = (CString)result.GetBSTR(); ofstream file; file.open("C:ramtry.csv", ios::out); if(file.is_open()) { file << strResult; } file.close(); |
|
|
|
只有小组成员才能发言,加入小组>>
1296 浏览 0 评论
2378 浏览 1 评论
2199 浏览 1 评论
2068 浏览 5 评论
2955 浏览 3 评论
1136浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
759浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
944浏览 0评论
1296浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 22:43 , Processed in 1.390566 second(s), Total 60, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号