Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger waveform capture on change event

Hardware: NI USB-6525

IDE: Microsoft Visual Studio

Language: C#

System: Windows 7

 

The end goal is to determine the amount of time between two digital signal rising edges. 

 

My attempt at generateing code:

1) Set up the event handeler to look for a rising edge on pin 0.

2) Once a rising edge happens, capture digital data for 2 seconds from pins 0 and 1.

3) Read waveform data from USB device.

4) Calculate time between rising edges. 

 

First off I have looked through the examples from National Instruments, but I cannot get these to do what I need for various reasons. Using callback functions with the begin and end waveform captures just seem to run too sluggish when i want to capture data for 2 seconds. 

 

In the code I have attached, I have not done step 4 above. I am just trying to read the waveform, however the waveform does not seem to populate when the change event occurs. Any reason why the waveform will not populate with the specified number of samples? I am able to read single samples or multiple samples on a single line, however I need to read a "waveform" to get all the information I need for the timing calculation. 

 

Attached is the C# code.

 

 

0 Kudos
Message 1 of 2
(5,569 Views)

Hello sross

 

Do you mean that you want to read a digital waveform? what do you have right now, an array with booleans? or you are talking about an analog waveform?

 

Regards

Frank R.

0 Kudos
Message 2 of 2
(5,547 Views)