07-15-2022 09:12 PM
I am trying to read data off of a Field Fox N9918A using LabVIEW.
Currently I am trying to measure Magnitude and Phase using LabVIEW. After watching a tutorial, I came up with the following setup:
The axis labels are clearly not right yet, but I'm having issues tracking the right data. I originally had only one write function, which also didn't work. I looked into the following manual for commands but have had no luck with them: FFProgramming7.75.pdf (keysight.com) I'm just trying to make it trace the X-axis at the moment but have had no luck. Any help would be greatly appreciated!
Solved! Go to Solution.
07-17-2022 04:12 AM - edited 07-17-2022 04:40 AM
The syntax of your commands looks wrong, those angle brackets are not part of the literal command but a SCPI way of indicating that this part of the command is optional because the remainder of the command is already unambiguously enough to determine what needs to be done. In the same way SCPI uses the uppercase and lowercase characters to indicate which part of a command segment is mandatory (usually the first 3 or 4 characters in uppercase) and what is optional (the remainder in lowercase).
Instruments should not care about the case of sent commands, but if they accept only partial optional parts is implementation specific. Many require that you either use the short form of a command or the full, but not anything in between.
If you want your FORMAT:DATA command to affect how the data is returned for the query command that ends with a question mark, you need to send that command first. When the device receives a query command, it executes it with the settings it has at that moment, not with settings that may or may not arrive a split second or a day or month later.
And the FORMAT:DATA command almost certainly needs an extra parameter to tell the device what sort of format it should use from now on. For instance FORMAT:DATA ASCII,0.
Also what interface are you using to connect to the device? If it is anything else than GPIB, you will need to also concern yourself about proper termination character handling.
07-20-2022 06:03 PM
Sorry for the late reply. I've been messing with it a bit and I managed to trace the y intercept of the field fox with the following setup. The two writes were not necessary for this task I'm trying to achieve.
That setup returns values like this.
This, indeed, is data I am looking for. However, there are many problems with it. The first of which being this only reads the first couple bits of data. It stops around 1/3rds of the way through reading results from the field fox, which causes a query error 410 (task not finishing before another one starting). The second of the issues is having multiple traces. I am looking for a way to trace two different traces on the field fox. The third of my concern is analyzing the data at a specific point, being the middle. I am mainly struggling with finding the right commands to input using LabVIEW and any solutions or resources would be greatly appreciated!
07-21-2022 03:24 AM - edited 07-21-2022 03:25 AM
Well, since you read ASCI and the returned data seems large, 1024 bytes seems not enough to read all of the response.
Alternatives:
- Reading more characters per go
- Reading in a loop and concatenating the results until you receive less characters than you requested or the last line is empty.
- Switch to binary mode and read back the header which says how many bytes of data follow and then read that data and Unflatten it to 32-bit float or 64-bit double depending on the mode you set it to.
07-22-2022 10:28 PM
Thanks, that helped! I got it to work for the most part, but now I'm trying to read precise time. The time delay only stops it from reading after already executing. How would I make it start counting as execution begins? Here is a sample of outputs I got with my new setup:
You can see the value for time after every double tab. How would I make them, let's say, every .2 seconds for example? I am fully aware of why it executes like that, but I need a solution for the issue.
07-23-2022 02:23 AM
It’s difficult to say from a distance but I assume each block is a read from the device in the loop.
- First option would be to add a Wait (ms) in parallel inside the loop. Not very accurate but it may be enough for your purposes.
- If you need more accurate timing you will have to RTFM. In there you can certainly program the device for timed acquisition and then start it before you enter the loop to read the measurements. The Query function will then only return whenever a new measurement is available (or after a VISA timeout, which certainly will be higher than 0,2 seconds but can be reprogrammed too with the VISA property Nodes).