02-19-2020 07:30 PM
I am trying to read data from a R4131D spectrum analyzer using NI Visa library in C#.
The manual provides some example on how to remotely control the instrument, using Basic code:
10 OUTPUT 701; "CF470MZ" - set Center Frequency to 470 MHz
20 OUTPUT 701; "OPCF" - instructs the equipment to output the set data of center frequency
30 ENTER 701; F - reads the data and fetches it to variable F
70 DISP F - displays the value of variable F (470 MHz)
I can use NI Visa to send the commands (for example, "CF470MZ" sets the center frequency to 470 MHz) and this part works fine. I use mbSession.Write(textToWrite) function. But I don't know how to get an answer back from this instrument. With other instruments, I use mbSession.Query(textToWrite). Typically the query on other instruments ends with a question mark, such as "*IDN?". With the above code, I am confused about the command "ENTER", which is used to specify a variable name that will store the result. I am guessing that is in fact the query and it probably sends "something" to the instrument (a string, a special character maybe?). I have at my disposal the functions mbSession.Write(), mbSession.ReadString() and mbSession.Query(). Does anybody know how can I get the result out of the instrument?
Thanks,
Nick_F
Solved! Go to Solution.
02-19-2020 11:08 PM
I omitted to say in my first post that this instrument is very old (the manual dates from 1989).
I found out that if I send a command, like "CF234MZ" the instrument is set to a center frequency of 234 MHz.
If I send the query with "OPCF", it will time out. But after it times out, the correct result is returned 00234000.00E+3 (I can see it in NI Spy).
Even if I manually set a different center frequency on instrument and then send the query "OPCF", I get the correct value, but only after time-out. If I set the span manually or with command "SP20MZ", I can query then with "OPSP" but the result, as before comes after time out (I can only see the result in NI Spy). I tried adding various termination characters such as "\n", "\r", "\r\n", null character (nothing) but without any luck.
02-20-2020 08:04 AM
I would have used NI's VISA Interactive Panel to manually communicate with the instrument. After I knew what its behavior was, then and only then, would I attempt automating the process.
.
02-20-2020 04:54 PM
Thanks for suggestion, I tried that as well. NI Max offers little apart for the three functions I mentioned - Write, Read, Query.
I played with Configure EOS without any luck, but the question remains the same. What query do I have to send to the instrument and what termination character to get an answer back.
02-20-2020 04:59 PM
You'll just have to keep trying everything.
Go over the manual again and see for there is anything you may have missed.
Instruments that old are tricky. No doubt about it.
Good luck.
02-20-2020 05:13 PM
I found the answer in a previous post about Advantest instruments.
Although I've seen the answer yesterday, I didn't think of trying it until today. I have to send the command "DL2" one time only, before I start the queries. DL2 stands for EOI (it is a block delimiter and it is described in the operating manual for R4131).
So the commands are like this:
Write "CF123MZ" - Set Center Frequency to 123 MHz
Write "SP20MZ" - Set Span to 20 MHz
Write "DL2" - send he block delimiter (probably DL is the short notation from DeLimiter)
Query "OPCF" - it returns 00123000.00E+3
Query "OPSP" - it returns 00020000.00E+3
02-20-2020 05:28 PM
Just in case somebody else may have to interact with a R4131 spectrum analyzer, here is a link to the pdf manual:
https://www.advantest.com/documents/11348/146687/pdf_mn_ER4131_OPERATING_MANUAL.pdf/d42f7b52-81ad-49... - we can't search for expressions in it.
I also found a pdf document that appears to be scanned and in that document, I can search for words (I don't know how it's done).
https://www.opweb.de/english/company/Advantest_Corporation/R4131C - it can be downloaded