Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

ExportSignal error to PFI 0 with a 2 channel PXIe-5413 device

I'm trying to use the ExportSignal function for a Pulse Trigger using Marker 0 with every period start. It works fine in the same chassis (PXIe-1083) for a PXI-5412 card, but fails with the following error on InitiateGeneraion when using the PXIe-5413:

 

Initiating generation.
Ivi.Driver.IviCDriverException: No device by the given name was found.
Error code: -88717

 

I'm using the ArbitrayWaveform example installed together with FGEN 20 and added Marker0. Please see my source code below. The funny thing is, that the same done with Labview works as expected. I also added this for reviewing. Any Idea why it doesn't work? My guess it's something about 1 and 2 channel cards. When I leave the last parameter of ExportSignal blank, it's generating, but without marker output to PFI0 of course. The same error is for RTSI0.

 

Patrick

 

static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("1. Initializing the signal generator session.");
                using (NIFgen session = new NIFgen(ResourceName, ChannelName, true, ""))
                {

                    Console.WriteLine("0. Active channel(s) {0}.", ChannelName);
                    session.ConfigureChannels(ChannelName);
                    // Set the output mode of the signal generator. Set this at the beginning of your 
                    // program to determine what the signal generator will output.
                    Console.WriteLine("2. Setting the signal generator's output mode to Arbitrary.");
                    session.Output.OutputMode = OutputMode.Arbitrary;

                    // Set the sample rate and sample clock mode. The actual sample rate will depend
                    // on the sample clock mode.
                    Console.WriteLine("3. Configuring the sample clock mode to \"{0}\" and the sample rate to {1} samples per second.", SampleClockMode, SampleRate);
                    session.Arbitrary.SampleRate = SampleRate;
                    session.Timing.SampleClock.ClockMode = ClockMode.Automatic;

                    int tmpBufferSize = Waveform.Length;
                    //session.Trigger.SetTriggerMode(ChannelName, TriggerMode.Burst);

                    Console.WriteLine("4. Enabling output on channel(s) {0}.", ChannelName);
                    session.Output.SetEnabled(ChannelName, true);

                    Console.WriteLine("5. Allocating memory up front for the waveform to generate.");
                    for (int i=0; i< Waveform.Length; i++)
                        {
                        Waveform[i] = Math.Sin((double)i / Waveform.Length * 2 * Math.PI);
                    }
                    int waveformHandle = session.Arbitrary.Waveform.Allocate(ChannelName, Waveform.Length);

                    Console.WriteLine("6. Downloading the waveform(s) to the Arbitrary Waveform Generator's memory for the channel(s) specified.");
                    session.Arbitrary.Waveform.Write(ChannelName, waveformHandle, Waveform);

                    Console.WriteLine("6.5. Export Signal");
                    session.Arbitrary.Waveform.MarkerPosition = 0;
                    
                    session.Event.Marker.SetOutputTerminal("Marker0", "PFI0");
                    session.Event.Marker.SetOutputBehavior("Marker0", OutputBehavior.Pulse);
                    //session.Event.Marker.SetPulseWidth("Marker0", 200.0e-9);
                    session.ExportSignal(SignalSource.MarkerEvent, "Marker0","PFI0");
                                       
                    // Gain can be set separately for each channel used.
                    // Additionally, if the trigger mode is set to Continuous, the gain can be
                    // changed on the fly after InitiateGeneration() has been called.
                    Console.WriteLine("7. Setting the gain for the channel(s).");
                    session.Arbitrary.SetGain(ChannelName, Gain);

                    Console.WriteLine("8. Initiating generation.");
                    session.InitiateGeneration();

                    // Wait until the generation is complete. If the trigger mode is set
                    // to Continuous, then WaitUntilDone will time out.
                    try
                    {
                        session.WaitUntilDone(TimeSpan.FromSeconds(30));
                        Console.WriteLine("9. Generation complete.");
                    }
                    catch (TimeoutException)
                    {
                        session.AbortGeneration();
                        Console.WriteLine("9. Generation was aborted.");
                    }
                }
            }
            // Handle driver-specific exceptions before the general exception handler that follows.
            // An example of a driver-specific exception is Ivi.Driver.IviCDriverException.
            catch (Exception e)
            {
                Console.WriteLine(e);
                
            }
            finally
            {
                Console.WriteLine("Program complete. Press any key to close.");
                Console.ReadKey();
            }
        }

Working Labview example:

petti_0-1634889653729.png

 

0 Kudos
Message 1 of 2
(342 Views)

Problem solved by cleaning the system from NI and reinstalling DAQmx and FGEN

 

But why happens this stupid error message No device by the given name was found?
Error code: -88717

It costs me a week, because generating worked without errors without ExportSignal function, PXI-5412 worked with the same source code including Marker0 export, Labview from another PC worked on the 5413 including Marker0 export.

My last try was to run the executable Labview software build on another PC (where it worked) with the Labview runtime on my computer, and here the error appeared as well.

0 Kudos
Message 2 of 2
(252 Views)