PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

I am using the PXIe-5413 (PXI Waveform Generator) in an application can't get the wave output to persist when the function ends.

I am using the PXIe-5413 (PXI Waveform Generator) in an application can't get the wave output to persist when the function ends. If a place a wait in the code just after the wave is generated, I can see the output wave as long as the wait is active. Once the wait expires and the function ends, the waveform disappears. How can I get the waveform to persist until I dispose of it?

 

Here is the code.

 

try

     {

         using (fGenSession = new NIFgen(resourceNameArg, false, true))

         {

              fGenSession.Output.OutputMode = OutputMode.Function;

              fGenSession.StandardWaveform.Configure("0", Waveform, amplitdeArg,                          DCOffsetArg, frequencyArg, startPhaseArg);

              fGenSession.InitiateGeneration();

              System.Threading.Thread.Sleep(5000);

                   

              return "Status: True; Result: " + Waveform.ToString() + "; Message: No Message";

                   

         }

     }

     catch (DaqException ex)

     {

        return "Status: False; Result: " + Waveform.ToString() + "; Message: " + ex.ToString();

     }

 

I'm looking for a simple explanation as I've only been programming in C#, .net, measurement studio for about 3 months.

 

Thanks in advance.

 

 

0 Kudos
Message 1 of 3
(1,856 Views)

Hi DeepSpace,

 

What happens when you omit the System.Threading function? Does the waveform continue on?  Do you have access to LabVIEW to try to make an example there then try to work backward from that? 

DillonL.
0 Kudos
Message 2 of 3
(1,787 Views)

I actually realized what the issue was. I had placed the code to associate the session with the device in the "using" statement. When the function ended, the using statement disposed of that association. I moved the code "fGenSession = new NIFgen(resourceNameArg, false, true)" into the body of the function, and deleted the using statement and it works fine now. Just one of those simple oversights.

 

Thanks for responding.

 

Regards,

0 Kudos
Message 3 of 3
(1,778 Views)