AnsweredAssumed Answered

E4440A - C Trace Data using VISA

Question asked by miguez on May 14, 2009
Latest reply on Nov 30, 2009 by miguez
I've been trying for a while to acquire the trace of the spectrum analyzer in REAL, 32 format using C# and VISA and not being able to get it -yet.
Currently the PSA E4448A series Spectrum Analyzer is being used with a LAN connection. It may  be something very simple to do since most of the code is already done.

The VISA is a class module in C# that refers to unhandled VISA functions from visa32.dll

Here's the code:

public Int32 SaveBinaryData(string sFilename)
  uint uiRCount = 0;                                //Creates an unsigned integer for a returned count of characters.
  string sResult = new string(' ', 20000);   //Creates a new string.
  long lStatus = VISA.viPrintf(vi, "%s\n", ":FORM:DATA REAL,32:TRACE:DATA?:TRACE1;*WAI");   //Sends to the spectrum analyzer a code to return the data in 32-b
  lStatus = VISA.viRead(vi, ref sResult, 20000, uiRCount);  //Read the result in sResult and should read the count of bytes in the uiRCount variable.
  sResult = sResult.Trim();                     //At this point you should see the binary values or at least something that looks like garbage which contains the real data in 32 bits.

Let me know what I am missing here. Currently using Visual Studio (C#) .NET 2005.


Juan Miguez