High-Speed Digitizers

cancel
Showing results for 
Search instead for 
Did you mean: 

time delay measurement using USB-5132

Hi all,

 

I'm trying to get the time difference between the falling edge of ch.1 and the rising edge of ch.0 using the time delay measurement.  This is what I have:

 


// setup usb-5132
niScope_init ("Dev1", NISCOPE_VAL_TRUE, NISCOPE_VAL_TRUE, &DigitizerHandle);
niScope_CalSelfCalibrate (DigitizerHandle, "0,1", NISCOPE_VAL_SELF_CALIBRATION);

niScope_ConfigureAcquisition (DigitizerHandle, NISCOPE_VAL_NORMAL);

niScope_ConfigureHorizontalTiming (DigitizerHandle, 500000, 200000, 10.0, 1, NISCOPE_VAL_TRUE);

// set mid reference to 10V for both channels
niScope_SetAttributeViInt32 (DigitizerHandle, "0,1", NISCOPE_ATTR_MEAS_REF_LEVEL_UNITS, NISCOPE_VAL_MEAS_VOLTAGE);
niScope_SetAttributeViReal64 (DigitizerHandle, "0,1", NISCOPE_ATTR_MEAS_CHAN_MID_REF_LEVEL, 10);

niScope_ConfigureVertical (DigitizerHandle, "0,1", 20, 10, NISCOPE_VAL_DC, 1.0, NISCOPE_VAL_TRUE);

// configure 5132 to trigger when ch. 1 crosses 12V on an upslope
handleErr(niScope_ConfigureTriggerEdge (DigitizerHandle, "1", 12, NISCOPE_VAL_POSITIVE, NISCOPE_VAL_DC, 0.0, 0.0));
// tell digitizer the ch.1's other is ch.0. this is needed for time delay measurement
handleErr(niScope_SetAttributeViString (DigitizerHandle, "1", NISCOPE_ATTR_MEAS_OTHER_CHANNEL, "0"));
// set ch.1 gain to -1 so that we get an upslope when in reality we want to measure from
// ch.1 downslope to ch.0 upslope

handleErr(niScope_SetAttributeViReal64 (DigitizerHandle, "1", NISCOPE_ATTR_MEAS_ARRAY_GAIN, -1));
handleErr(niScope_AddWaveformProcessing (DigitizerHandle, "1", NISCOPE_VAL_ARRAY_GAIN));

// tell 5132 to wait for trigger
handleErr(niScope_InitiateAcquisition(DigitizerHandle));

Delay (.5);

// here is where ch.1 is set low and after that ch.0 will go high

// get result of measurement
handleErr(niScope_FetchMeasurement (DigitizerHandle, "1", 1, NISCOPE_VAL_TIME_DELAY, &results));

 My problem is that niScope_FetchMeasurement() is returning the error "NON-FATAL RUN-TIME ERROR:   "code.c", line 2056, col 5, thread id 0x00000268:   Function niScope_FetchMeasurement: (return value == -1074126845 [0xbffa2003]). Maximum time exceeded before the operation completed.

 

I know that ch.1 going low to ch.0 going high is much less than a second (around 125 uS) yet it's still timing out.

 

Any ideas what I'm doing wrong?  Thanks.

 

 

0 Kudos
Message 1 of 4
(7,313 Views)

Hello,

 

In order for the Time Delay measurement to be able to be performed, it needs to have 2 mid reference crossings be seen from the data returned for the "Other Channel" when the data is fetched to properly make the measurement. It seems to me that it's likely the second mid reference level crossing is not seen from the fetched data from channel 0 of your setup. Does your channel 0 signal go from low to high and then back to low? or does it just go from low to high? I have a feeling that this is causing the fetch measurements function to time out because it is not seeing the proper levels before the timeout value is set. 

 

If your signal does go from low to high and then back to low, the other thing that may be happening, is that the high time of that channel 0 pulse is too long and the falling edge that is needed by the measurements function is not actually being acquired. This could be easily fixed by setting your record length to be longer. I hope this helps.

 

Chris W

Message 2 of 4
(7,300 Views)

A number of things:

 

1.  Should the Ch.1 trigger be set to rising or falling edge?  I currently have it set to rising edge as that is what the signal is doing after inverting but in reality it is a falling edge that I want to trigger on, which is it?  Along similar thinking, should Ch.1's mid reference point by 10 or -10?

 

2.  Is there any way to see the waveform inverted on the NI_SCOPE Soft Front Panel?

 

3.  Here are my waveforms:

 

SFP waveform.JPG

I'm not concerned with the rising edge of Ch.1 it is only the first falling edge which triggers Ch.0 to go high.  So the sequence of events is that Ch.1 goes low (drops below 10V), Ch.0 goes high then Ch.0 goes low thus completing both mid reference crossings for Ch.0.

 

4.  I've now set the Minimum Sample Rate to 2MS/s and the Minimum Number of Points to 1,000,000.  This should give me 0.5 seconds of data, which according to the screenshot above is enough time to get all the mid reference level crossings Delay Time measurement needs.

 

With all the mid reference crossings and the proper amount of sample time I'm still seeing "Maximum time exceeded..." errors.  Any more ideas?  Thanks for your responses.

0 Kudos
Message 3 of 4
(7,284 Views)

Hi TestEngineer503,

 

It appears from your waveforms and how you have your program configured that you are triggering off that sharp rising edge, which occurs midway through when CH0 is high. Therefore, it does not appear that it is seeing the first rising edge on CH0. For triggering purposes, you should set the trigger to be a falling edge, just as you have in the Soft Front Panel.

 

Unfortunately, there is no way to invert the signal on the Soft Front Panel. As far as the mid-reference point, I believe that you would want to set it as -10 since the inversion will be performed before the measurement is performed. Thus, the point in the waveform that was at 10 will now be at -10, and this is the point you want to measure from. Hope this helps,

Daniel S.
National Instruments
0 Kudos
Message 4 of 4
(7,266 Views)