LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to read data off of a fieldfox N9918A

Solved!
Go to solution

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:

Screenshot 2022-07-15 160738.png

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!

0 Kudos
Message 1 of 6
(2,559 Views)

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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 6
(2,519 Views)

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.

AndrewW7_0-1658357826334.png

That setup returns values like this.

AndrewW7_1-1658357881335.png

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!

 

0 Kudos
Message 3 of 6
(2,484 Views)

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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 6
(2,476 Views)

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:

AndrewW7_0-1658546762034.png


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.

0 Kudos
Message 5 of 6
(2,458 Views)
Solution
Accepted by topic author AndrewW7

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). 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 6
(2,453 Views)