1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
附件是一个简短的matlab程序,向您展示如何使用matlab中的Agilent 33210A,33220A或33250A打开签证会话并下载任意波形并使用函数发生器输出。
这个例子是一个非常基本的脉冲波形,你可以创建更复杂的波形,我只想做一个简单的例子让人们开始.-------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -----------%{AsciiArb是一个示例程序,演示如何下载任意waveforminto仪器易失性存储器并使用以下配置回放相同的内容:此arb生成8192点脉冲波形,其中 波前形状:ArbAmplitude:2 Volt Peak to PeakOffset:0 VoltOutput Impedance:50 OhmOutput:Enabled此示例适用于Agilent 33210A,33220A和33250A%}前400个点定义从0伏到最大定义电压幅度的正向脉冲。波形 %清除所有变量,关闭所有打开的文件清除所有; 关闭所有; clc;%打开并创建一个签证会话,用于与函数generatorfgen = visa('AGILENT','TCPIP0 :: 156.140.92.62 :: inst0 :: INSTR')进行通信;设置(fgen,'OutputBufferSize',100000); fopen( fgen);%查询Idendity字符串和reportfprintf(fgen,'* IDN?'); idn = fscanf(fgen); fprintf(idn)fprintf(' n n')%清除并重置instrumentfprintf(fgen,'* RST '); fprintf(fgen,'* CLS');%使用8192点0-1 datafprintf创建arb波形('生成波形... n n')rise = [];对于i = 1:1: 10%设定上升时间(10分)* / z =(i-1)/ 10; y = num2str(z); s1 = sprintf(',%s',y); 上升= [上升s1]; end width = [];对于i = 11:1:411%设置脉冲宽度(400点)* / y = num2str(1); s2 = sprintf(',%s',y); width = [width s2]; end fall = []; for i = 412:1:422%设置下降时间(10分)* / z =(422-i)/ 10; y = num2str(z); s3 = sprintf(',%s',y); 跌倒= [跌倒s3]; 结束低= [];对于i = 423:1:8192%将剩余点设置为零* / y = num2str(0); s4 = sprintf(',%s',y); 低= [低s4]; end%组合所有字符串s = [上升宽度下降低]; %将数据字符串与scpi commandarbstring = sprintf('DATA VOLAtiLE%s',s)组合在一起; %Send命令设置所需的configurationfprintf('下载波形... n n')fprintf(fgen,arbstring); %make instrument等待数据下载,然后转到下一个%命令setfprintf(fgen,'* WAI'); fprintf('Download Complete n n')%设置所需的配置。 fprintf(fgen,'VOLT 2'); %将最大波形幅度设置为2 Vpp fprintf(fgen,'VOLT:OFFSET 0'); %将偏移设置为0 V fprintf(fgen,'OUTPUT:LOAD 50'); %将输出负载设置为50欧姆fprintf(fgen,'FREQ 1000'); %设定频率为1KHz fprintf(fgen,'FUNC:USER VOLATILE'); fprintf(fgen,'FUNC:SHAP USER'); %启用输出fprintf(fgen,'OUTPUT ON'); %打开通道1输出%读取Errorfprintf(fgen,'SYST:ERR?'); errorstr = fscanf(fgen);%error checkingif strncmp(errorstr,'+ 0,“No error”',13)errorcheck ='Arbitrary 生成的波形没有任何错误 n'; fprintf(错误检查)else errorcheck = ['错误报告:',errorstr]; fprintf(errorcheck)end%用函数generatorfclose(fgen)关闭签证会话; 以上来自于谷歌翻译 以下为原文 Attached is a short matlab program that shows you how to open a visa session with an Agilent 33210A, 33220A, or 33250A in matlab and download an arbitrary waveform and output it with the function generator. The example is a very basic pulse waveform, you can create much more complex waveforms, I just wanted to make a simple example to get people started. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- %{ AsciiArb is a sample program that demonstrates how to download an arbitrary waveform into instrument volatile memory and play back the same with the configuration below: This arb generates a 8192 point pulse waveform, of which the first 400 points define a positive pulse from 0 volts to the maximum defined voltage amplitude. Wave Shape: Arb Amplitude: 2 Volt Peak to Peak Offset: 0 Volt Output Impedance: 50 Ohm Output: Enabled This example will work with the Agilent 33210A, 33220A, and 33250A %} % clears all variables, closes all open files clear all; close all; clc; %opens and creates a visa session for communication with function generator fgen = visa('AGILENT','TCPIP0::156.140.92.62::inst0::INSTR'); set (fgen,'OutputBufferSize',100000); fopen(fgen); %Query Idendity string and report fprintf (fgen, '*IDN?'); idn = fscanf (fgen); fprintf (idn) fprintf ('nn') %Clear and reset instrument fprintf (fgen, '*RST'); fprintf (fgen, '*CLS'); % Create arb waveform with 8192 points of 0-1 data fprintf('Generating Waveform...nn') rise=[]; for i = 1:1:10 % Set rise time (10 points) */ z = (i-1)/10; y = num2str(z); s1 = sprintf(', %s', y); rise = [rise s1]; end width=[]; for i= 11:1:411 % Set pulse width (400 points) */ y = num2str(1); s2 = sprintf(', %s', y); width = [width s2]; end fall=[]; for i = 412:1:422 % Set fall time (10 points) */ z= (422 - i)/10; y = num2str(z); s3 = sprintf(', %s', y); fall = [fall s3]; end low=[]; for i = 423:1:8192 % Set remaining points to zero */ y = num2str(0); s4 = sprintf(', %s', y); low = [low s4]; end %combine all of the strings s = [rise width fall low]; % combine string of data with scpi command arbstring =sprintf('DATA VOLATILE %s', s); %Send Command to set the desired configuration fprintf('Downloading Waveform...nn') fprintf(fgen, arbstring); %make instrument wait for data to download before moving on to next %command set fprintf(fgen, '*WAI'); fprintf('Download Completenn') %Set desired configuration. fprintf(fgen,'VOLT 2'); % set max waveform amplitude to 2 Vpp fprintf(fgen,'VOLT:OFFSET 0'); % set offset to 0 V fprintf(fgen,'OUTPUT:LOAD 50'); % set output load to 50 ohms fprintf(fgen,'FREQ 1000'); %set frequency to 1KHz fprintf(fgen,'FUNC:USER VOLATILE'); fprintf(fgen,'FUNC:SHAP USER'); %Enable Output fprintf(fgen,'OUTPUT ON'); % turn on channel 1 output % Read Error fprintf(fgen, 'SYST:ERR?'); errorstr = fscanf (fgen); % error checking if strncmp (errorstr, '+0,"No error"',13) errorcheck = 'Arbitrary waveform generated without any error n'; fprintf (errorcheck) else errorcheck = ['Error reported: ', errorstr]; fprintf (errorcheck) end %closes the visa session with the function generator fclose(fgen); 附件
|
|
相关推荐
5个回答
|
|
嗨Lokesh,您的VISA会话的超时值设置得太短。
示例程序是为33220A编写的,它可以比33250A更快地下载任意波形。 修复代码addset(fgen,'timeout',25);在这些下面(fgen,'OutputBufferSize',100000);命令将超时值设置为25秒。 默认值为10秒,这是33250A下载整个波形的时间不够。谢谢!Mueller 以上来自于谷歌翻译 以下为原文 Hi Lokesh, The timeout value on your VISA session is set too short. The example program was written for the 33220A which downloads arbitrary waveforms faster than the 33250A. To fix the code add set (fgen,'timeout', 25); underneath the set (fgen, 'OutputBufferSize',100000); command to set the timeout value to 25 seconds. The default is 10 seconds which is not enough time for the 33250A to download the entire waveform. Thanks! Mueller |
|
|
|
嗨斯蒂芬,谢谢你的工作.Reards,Lokesh
以上来自于谷歌翻译 以下为原文 Hi stephen, Thanks it worked. Regards, Lokesh |
|
|
|
嗨,斯蒂芬,我修改了你的代码,用64K数据样本编程我的33250A。
它似乎工作得很好,直到我得到“数据超出范围”如下:安捷伦科技,33250A,0,2.04-1.01-2.00-03-2生成波形...下载波形...下载CompleteError报告:-222, “数据超出范围”-222错误消息是什么意思? 我该怎么解决? 附上代码供您参考。 非常感谢 以上来自于谷歌翻译 以下为原文 Hi Stephen, I modified your code to program my 33250A with 64K data samples. It seems working fine untill I got the "Data out of range" as the following: Agilent Technologies,33250A,0,2.04-1.01-2.00-03-2 Generating Waveform... Downloading Waveform... Download Complete Error reported: -222,"Data out of range" What does the -222 error message mean? how can I fix it? The codes are attached for your reference. Many thanks 附件
|
|
|
|
我看了一下你的程序,问题是你得到的波形数据远大于+/- 1。
您需要缩放数据,以便限制在+/- 1之上。您可以执行此操作.c = B / Max(B); y = num2string(c);截至目前,您的最大结果是1.5425e +003(最小值为164.915)我不认为这是你的意图所以我会检查你的波形方程。 您需要将其缩放到+/- 1,其中c = B / Max(B)将执行此操作,但这假设您的等式是正确的。 以上来自于谷歌翻译 以下为原文 I took a look at your program and the problem is your resultant waveform data is much greater than +/-1. You need to scale your data so that the limits top out at +/-1. You could do this. c=B/Max(B); y = num2string(c); As of now your max result of B is 1.5425e+003 (the min is 164.915) and I don't think this was your intention so I would check your waveform equation. You need to scale this to +/- 1 which c=B/Max(B) will do, but that is assuming your equation is correct. |
|
|
|
不幸的是33250A只支持64K点任意波形.33521A和33522A支持1M点arbs标准,可以升级到支持16M点arbs
以上来自于谷歌翻译 以下为原文 Unfortunately the 33250A only supports 64K point arbitrary waveforms. The 33521A and 33522A support 1M point arbs standard, and can be upgraded to suppport 16M point arbs |
|
|
|
只有小组成员才能发言,加入小组>>
1283 浏览 0 评论
2371 浏览 1 评论
2189 浏览 1 评论
2062 浏览 5 评论
2946 浏览 3 评论
1104浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
751浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
922浏览 0评论
1284浏览 0评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 20:32 , Processed in 1.501567 second(s), Total 81, Slave 65 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号