RF Measurement Devices

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting NI-RFSA C# .NET to .NET C wrapper code

Hi,

 

I'm trying to convert some NI-RFSG code using C# and the .NET APIs to the NI-RFSG .NET C wrappers. I know the former is recommended but from what I understand, the latter is the only way to proceed if I want to move beyond .NET framework 4.8 because NI support is lacking.

 

Here's some original .NET API code:

 

======================================================

double frequency = 999.0;

double power = 1.0;

_rfsgSession = new niRFSG(rfsgResourceName, true, false);

_rfsgSession.RF.Configure(frequency, power);

_rfsgSession.Arb.GenerationMode=RfsgWaveformGenerationMode.Script;

======================================================

 

Converting to use the wrapper it starts out the same...

 

double frequency = 999.0;

double power = 1.0;

_rfsgSession = new niRFSG(rfsgResourceName, true, false);

 

The next line I found in some example code with the wrapper and could have figured out myself easily enough.

_rfsgSession.ConfigureRF(frequency, power);

 

.. but I quickly ran into a problem setting generation mode.

Should I use:

_rfsgSession.ConfigureGenerationMode(NIRFSG_VAL_SCRIPTNI-RFSG);

 

Two problems here.. one the code mentions the device must be in configuration mode to use this call (with nothing equivalent in the plain .NET code), the second the constant in the brackets is not defined, even if I add this to some example code that came with the .NET C wrapper. Problem is the example code is very limited so there's nothing equivalent where it uses a similar constant. I've looked at niRFSGConstants class in the wrapper and done a search and I can't see a definition.

 

There's also _rfsgSession.SetGenerationMode() but this uses channel names which is something different again to the .NET code.

 

As you can see, I'm floundering here. Any advice gratefully received, ideally I would like to start from a basic example using the wrapper to generate a triggered arbitrary scripted waveform but as I said the examples with the wrapper are very limited - there is only one.

 

Hopefully someone can point me to the glaring resource I'm missing to answer all my questions!

 

Thanks

 

0 Kudos
Message 1 of 1
(66 Views)