• 0
Steven_1988

Digital Discovery Trigger more than certain length

Question

Posted (edited)

Hello,

i am trying to trigger an High Speed Pin after a certain length of a pulse. With the waveform software this works perfectly. Inside my c# code the "dwf.FDwfDigitalInTriggerLengthSet" has no effect. It doesn´t matter if i use 30ns or 10s for the minimum length.

-> It triggers always directly after the first glitch of about 10ns.

Thank you for your help in advance.

Steven

What am i doing wrong? Here the code:

            //Number of samples to acquire after the trigger (10 bit with 10Mhz)
            int number_of_samples = Convert.ToInt32(_frequency/(1e6));
            //Digital In
            //Set State to Configure
            dwf.FDwfDigitalInConfigure(_hdwf, 0, 0);
            //First reset
            dwf.FDwfDigitalInReset(_hdwf);
            //Get the internal clock frequency
            double hzSys = 0;
            dwf.FDwfDigitalInInternalClockInfo(_hdwf, out hzSys);
            //Set the frequenzy of the signal in Hz
            UInt32 divider = Convert.ToUInt32(hzSys / _frequency);
            dwf.FDwfDigitalInDividerSet(_hdwf, divider);
            //set record mode
            //in record mode samples after trigger are acquired only
            dwf.FDwfDigitalInAcquisitionModeSet(_hdwf, dwf.acqmodeRecord);
            //Set the sample format to 8 bit (1 Byte)
            dwf.FDwfDigitalInSampleFormatSet(_hdwf, 8);
            // number of samples after the trigger
            dwf.FDwfDigitalInTriggerPositionSet(_hdwf, Convert.ToUInt32(number_of_samples));
            //Number of samples to acquire before the trigger (20)
            dwf.FDwfDigitalInTriggerPrefillSet(_hdwf, 20);
            //Set the channels to record
            List<Byte> Record_PIN = new List<Byte>();
            //Set the channels to record 0,1,2
            Record_PIN.Add(0);
            Record_PIN.Add(1);
            Record_PIN.Add(2);
            dwf.FDwfDigitalInSampleSensibleSet(_hdwf, create_Bit_field_32(Record_PIN));           
            // Set Sample Mode Simple (One Sample every divider clock pulse)
            dwf.FDwfDigitalInSampleModeSet(_hdwf, dwf.DwfDigitalInSampleModeSimple);
            ////Sample settings
            //Configure the order of the sample array (DI first)
            dwf.FDwfDigitalInInputOrderSet(_hdwf, 0);              
            //Set Trigger Mode to "normal"
            dwf.FDwfDigitalInTriggerAutoTimeoutSet(_hdwf, 0);
            //Set Trigger to channel 2
            List<Byte> Trigger_PIN = new List<Byte>();
            //Trigger_PIN.Add(1);
            Trigger_PIN.Add(2);
            dwf.FDwfDigitalInTriggerSet(_hdwf, 0, create_Bit_field_32(Trigger_PIN),0 , 0);
            //Set TriggerLength to minimum 50ns            
            dwf.FDwfDigitalInTriggerLengthSet(_hdwf, 50e-9, -1, 0);            
            //Set Trigger to DigitalIn
            dwf.FDwfDigitalInTriggerSourceSet(_hdwf, dwf.trigsrcDetectorDigitalIn);
            //Acquire and Start Recording
            //Start acquiring
            dwf.FDwfDigitalInConfigure(_hdwf, 1, 1);

Edited by Steven_1988

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi @attila,

thank you for the really fast answer. I tried as you wrote. I added the following line, to Trigger a positive pulse:

         dwf.FDwfDigitalInTriggerResetSet(_hdwf, 0, 0, Trigger_PIN, 0);
         dwf.FDwfDigitalInTriggerSet(_hdwf, 0, Trigger_PIN,0 , 0);
 

Still it doesn´t matter what time i use in "TriggerLengthSet":

          dwf.FDwfDigitalInTriggerLengthSet(_hdwf, 0.5, -1, 0);

If there is a signal on the Trigger Pin the samples are recorded and the recording goes to state "Done". How can i just Trigger when a pulse has a certain length?

Steven

Share this post


Link to post
Share on other sites

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