Jump to content
  • 0

Use Digital Trigger to Start/Stop acquisition in Analog discovery 3


Aissa Akrikez

Question

Hello, I am trying to acquire information from the analogue channel and I have already configured the trigger from a digital pin to start the data acquisition, now I am trying to finish the data acquisition through the next trigger. As much as I search, I can't find much information on this subject. I have tried dwf.FDwfDigitalInStatus(hdwf, out sts2) to stop the acquisition, but it counts infinitely and without stopping even though I get the pulses every 2 or 3 seconds. Can anyone help me?

This is the configuration I am using 

Quote

 ///PARAMETROS DE GENERACION DE SEÑAL  
 dwf.FDwfAnalogOutNodeEnableSet(hdwf, 0, dwf.AnalogOutNodeCarrier, 1);
 // set sine function
 dwf.FDwfAnalogOutNodeFunctionSet(hdwf, 0, dwf.AnalogOutNodeCarrier, 3);
 // 5khz

 dwf.FDwfAnalogOutNodeFrequencySet(hdwf, 0, dwf.AnalogOutNodeCarrier, 0.205338809);
 // 1.41V amplitude (1Vrms), 2.82V pk2pk
 dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, 0, dwf.AnalogOutNodeCarrier, 1);
 // 1.41V offset
 dwf.FDwfAnalogOutNodeOffsetSet(hdwf, 0, dwf.AnalogOutNodeCarrier, 1);
 dwf.FDwfAnalogOutNodeSymmetrySet(hdwf, 0, dwf.AnalogOutNodeCarrier, 1);
 dwf.FDwfAnalogOutConfigure(hdwf, 0, 1);

 //////////////////
 //set up acquisition #######
 dwf.FDwfAnalogInFrequencySet(hdwf, AcqHz);                 // set acquisition frequency 
 dwf.FDwfAnalogInBufferSizeSet(hdwf, Samples);                 // set the buffer size for AnalogIn
 dwf.FDwfAnalogInChannelRangeSet(hdwf, 0, ChlRange);

 //////////////
 //set up trigger for the analog channel to be the DigitalInDetector
 dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, 0);            // disable auto trigger at analog channel
 dwf.FDwfAnalogInTriggerSourceSet(hdwf, dwf.trigsrcDetectorDigitalIn);    // set the triggger source for the analog channels to be the DigitalInTriggerDetector
                                                                          // move trigger to left boundary, otherwise the signal will start in the middle
 dwf.FDwfAnalogInTriggerPositionSet(hdwf, 0.0); ; // Configures the horizontal trigger position in seconds.
                                                  // settings for the trigger on digital channel
 double hzDI;
 dwf.FDwfDigitalInInternalClockInfo(hdwf, out hzDI);
 //sample rate = system frequency / divider
 dwf.FDwfDigitalInDividerSet(hdwf, (uint)(hzDI / 100e6));

 // Configuracion del pineado
 // Configura el bit correspondiente al pin 0 (DIO0) como 1
 dwf.FDwfDigitalInTriggerSet(hdwf, 0, 0, 0, 1 << 0);
 dwf.FDwfDigitalInInputOrderSet(hdwf, 1);
 dwf.FDwfAnalogInChannelEnableSet(hdwf, 0, 1);   // enable Analog Channel 1
 dwf.FDwfDigitalInConfigure(hdwf, 1, 1);
 //dwf.FDwfAnalogInConfigure(hdwf, 1, 1);
 Thread.Sleep(2000);
 

and this is the main loop

Quote

  while (isReceptionActive)
  {
      while (true)
      {
          dwf.FDwfAnalogInStatus(hdwf, 1, out sts);
          // dwf.FDwfDigitalInStatus(hdwf, 1, out sts2);

          if (sts == 2)
          {
              vuelta++;
              string texto = "Vuelta: " + vuelta.ToString();
              ActualizarTextoEnInterfaz(texto);

              contador = 0;
              break;
          }
          Thread.Sleep(1);
      }
      stopwatch1.Start();

      dwf.FDwfAnalogInStatusData(hdwf, 0, nSamplesCh1, Samples);
  }

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...