是德科技
直播中

王莉淳

8年用户 260经验值
私信 关注
[问答]

将校准数据写入ENA遇到问题

嗨,我在将校准数据以实际格式写入ENA分析仪时遇到了问题。
我正在使用SICL和VB6。
以下ASCII码工作正常:Dim Pt1r $,Pt1i $,Pt2r $,Pt2i $,Cmd $ Pt1r =“+ 1.00000000000E + 000,”Pt1i =“+ 0.00000000000E + 000,”Pt2r =“+ 1.00000000000E + 000
,“Pt2i =”+ 0.00000000000E + 000“呼叫ivprintf(AnaId,”FORM:DATA ASC;“,0&)Cmd =”:SENS:CORR:COEF ED,1,1,“&
Pt1r&
Pt1i&
Pt2r&
Pt2i&
Chr $(10)调用ivprintf(AnaId,Cmd,0&)但我需要提高性能。
我尝试使用REAL格式的许多变体,似乎没有任何工作。
例如:Dim Pt1r#,Pt1i#,Pt2r#,Pt2i#,字节%,Cmd $ Pt1r = 1#Pt1i = 0#Pt2r = 1#Pt2i = 0#调用ivprintf(AnaId,“FORM:DATA REAL;”&
; Chr $(10),0&)字节= 2 * 2 * 8 Cmd =“:SENS:CORR:COEF ED,1,1#6”&
格式$(字节,“000000”)调用ivprintf(AnaId,Cmd,0&)调用iswap(Pt1r,8,8)调用iwrite(AnaId,Pt1r,8,0,0&)调用iswap(Pt1i,8,8)
)调用iwrite(AnaId,Pt1i,8,0,0&)调用iswap(Pt2r,8,8)调用iwrite(AnaId,Pt2r,8,0,0&)调用iswap(Pt2i,8,8)调用iwrite(
AnaId,Pt2i,8,1,0&)任何帮助解决这个问题都会非常受欢迎。
谢谢。

以上来自于谷歌翻译


     以下为原文

  Hi,

I'm having problems writing calibration data to an ENA analyzer in real format.  

I'm using SICL with VB6. The following ASCII code works fine:

    Dim Pt1r$, Pt1i$, Pt2r$, Pt2i$, Cmd$
     
    Pt1r = "+1.00000000000E+000,"
    Pt1i = "+0.00000000000E+000,"
    Pt2r = "+1.00000000000E+000,"
    Pt2i = "+0.00000000000E+000"
     
    Call ivprintf(AnaId, "FORM:DATA ASC;", 0&)
     
    Cmd = ":SENS:CORR:COEF ED,1,1," & Pt1r & Pt1i & Pt2r & Pt2i & Chr$(10)
     
    Call ivprintf(AnaId, Cmd, 0&)


But I need to improve the performance. I've tried many variations using the REAL format, and nothing seems to work. For example:

    Dim Pt1r#, Pt1i#, Pt2r#, Pt2i#, Bytes%, Cmd$
     
    Pt1r = 1#
    Pt1i = 0#
    Pt2r = 1#
    Pt2i = 0#
     
    Call ivprintf(AnaId, "FORM:DATA REAL;" & Chr$(10), 0&)
     
    Bytes = 2 * 2 * 8
     
    Cmd = ":SENS:CORR:COEF ED,1,1#6" & Format$(Bytes, "000000")
     
    Call ivprintf(AnaId, Cmd, 0&)
     
    Call iswap(Pt1r, 8, 8)
    Call iwrite(AnaId, Pt1r, 8, 0, 0&)
     
    Call iswap(Pt1i, 8, 8)
    Call iwrite(AnaId, Pt1i, 8, 0, 0&)
     
    Call iswap(Pt2r, 8, 8)
    Call iwrite(AnaId, Pt2r, 8, 0, 0&)
     
    Call iswap(Pt2i, 8, 8)
    Call iwrite(AnaId, Pt2i, 8, 1, 0&)


Any help fixing this would be extremely well received.

Thanks.  

回帖(10)

李鑫赢

2019-3-13 11:22:58
我通常通过VISA函数进行I / O,所以我的SICL知识有点生疏,但有一件事我认为你想要将最后一个参数的非零(例如1)值传递给最后一个iwrite调用,这样它就会
进行终端握手。
但是,当你制定标题时,我相信你在'#'之前错过了一个逗号;
我在这里添加了它:Cmd =“:SENS:CORR:COEF ED,1,1,#6”&
格式$(字节,“000000”)另外,因为在这个例子中你只发送了总共32个字节的数据,所以包含四个前导零(“#6000032”)似乎有点奇怪,尽管可能是ENA
确实接受了。但我会使用VB CStr函数将'Bytes'变量转换为字符串,然后使用该字符串上的Len函数为你提供'#'之后的数字,所以对于这个例子你的
块头将是“#232”。

以上来自于谷歌翻译


     以下为原文

  I usually do I/O via VISA functions so my SICL knowledge has gotten a little rusty, but for one thing I believe you want to pass a nonzero (e.g. 1) value for the last argument to that last iwrite call, so that it will do the End-Of-Line handshake.  But also I believe you're missing one comma right prior to the '#' when you're formulating the header; I've added it here:

Cmd = ":SENS:CORR:COEF ED,1,1,#6" & Format$(Bytes, "000000")

Also since in this example you're sending just 32 total bytes worth of data, it seems maybe a bit odd to include the four leading zeroes (""#6000032"), although perhaps the ENA does accept that.  But I would use maybe the VB CStr function to convert the 'Bytes' variable to a string and then use the Len function on that string to give you the digit that goes after the '#', so for this example your block header would be "#232".
举报

王莉淳

2019-3-13 11:35:15
感谢您的反馈。
是的,同意Visa是新发展的方式,我计划在未来的某个阶段改变它。
我实际上尝试了大约100种不同的标题排列和终止字符等,但没有成功。
在我提供的示例中,最后一个二进制写入设置了'endi'标志,因此它应该在最后一次写入后发送一个END,但我也尝试发送一个 n或chr $(10)等作为终止
太。
我也尝试了两种方式,在':SENS:CORR:COEF ED,1,1'命令之后使用逗号,还有一个空格,其中没有这些似乎可以改进。
该手册建议只有ASCII传输才需要逗号,但无论如何我都进行了实验。
有了字节标题,我也尝试用各种不同格式编写它们。
还有其他任何建议,因为我正在把这头发拉出来!

以上来自于谷歌翻译


     以下为原文

  Thanks for the feedback. Yes, agreed Visa is the way to go for new developments, and I plan to change this over at some stage in the future.

I've actually tried around 100 different permutations of the header, and termination characters etc, without success.

In the example I provided, the last binary write has the 'endi' flag set, so it should send an END after the final write, but I've also experimented with sending a n or chr$(10) etc as the termination too.

I've also tried it both ways, with a comma after the ':SENS:CORR:COEF ED,1,1' command, and also a Space, and non of these seems to improve things. The manual suggests that a comma is only required for ASCII transfer, but I experimented anyway.

With the bytes header, I've also experimented with writing these in all different formats too.

Any other suggestions, as I'm pulling my hair out on this one!
举报

王莉淳

2019-3-13 11:42:54
另外,关于这个:+此外,因为在这个例子中你只发送了32个字节的数据,所以包含四个前导零(“#6000032”)似乎有点奇怪,尽管ENA可能确实接受了
但是我可能会使用VB CStr函数将'Bytes'变量转换为字符串,然后使用该字符串上的Len函数为你提供'#'之后的数字,所以对于这个例子你的块标题会
是“#232”。+我刚刚重读了手册中关于此的部分,我很确定它必须是#6,但在这个阶段我准备尝试任何东西,所以我会给
那也是。

以上来自于谷歌翻译


     以下为原文

  Also, regarding this:

+Also since in this example you're sending just 32 total bytes worth of data, it seems maybe a bit odd to include the four leading zeroes (""#6000032"), although perhaps the ENA does accept that. But I would use maybe the VB CStr function to convert the 'Bytes' variable to a string and then use the Len function on that string to give you the digit that goes after the '#', so for this example your block header would be "#232".+

I just re-read the section in the manual on this, and I'm pretty sure it has to be #6, but at this stage I'm prepared to try anything, so I'll give that a go too.
举报

李鑫赢

2019-3-13 11:50:44
哎呀,我现在注意到你在最后一次iwrite调用中对'endi'有值1 - 最初我错误地看了0这是你的'actualCnt'参数。
我实际上是PNA的固件工程师,所以我对PNA的具体信息比ENA了解得多,但我可以告诉你,在PNA上传输带有类似命令的binblock数据时,我提到了额外的逗号。
ENA和PNA共享底层框架代码,定义了SCPI行为的规则,所以我希望即使对于二进制情况,也可以使用该ENA命令的逗号,同样地,如果该命令需要数据头,我会发现它不常见
明确地从'#6'开始,但也许ENA团队可能已经这样定义了它。
我希望VB6在内存中连续包含Double数据类型的每个数组,在这种情况下,如果你调暗4个双打的数组,我认为你可以设置这4个元素而不是你的单个Double变量。
然后你可以将该数组的元素0传递给一个'iswap'调用,你将'length'参数指定为32,或者将ENA发送给“FORM:BORD SWAPped”命令然后你不需要做任何'iswap'

并且您可以将数组的元素0传递给单个“iwrite”调用(再次使用增加的“length”参数)而不是4个单独的调用。
在过去的几年里,我用VB6类型的数组完成了这一点。

以上来自于谷歌翻译


     以下为原文

  Oops yes I do note now that you have value 1 for 'endi' on that last iwrite call -- initially I was mistakenly looking at the 0 which is your 'actualCnt' argument.

I am actually a firmware engineer for the PNA and so I know much more about PNA specifics than ENA, but I can tell you that extra comma I mentioned to you is required when transferring binblock data with similar commands on the PNA.  The ENA and PNA have shared underlying framework code defining rules for SCPI behaviors, so I would expect the comma to also be required with that ENA command even for the binary case, and similarly I would find it unusual if that command required the data header to explicitly start with '#6', but perhaps the ENA team could have defined it that way.

I would expect VB6 packs each array of the Double data type contiguously in memory, in which case if you dim an array of 4 Doubles, I would think you could set those 4 elements instead of your individual Double variables.  Then you could pass element 0 of that array to a single 'iswap' call where you specify 'length' argument as 32, or alternatively send the ENA the "FORM:BORD SWAPped" command then you would not need to do any 'iswap'.  And you could pass element 0 of your array to a single 'iwrite' call (again with increased 'length' argument) instead of the 4 separate calls.  I've done that with arrays of type Byte with VB6 in years past.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分