Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

ANSI C: deal with something on every rising edge input

Solved!
Go to solution

Hi everyone,

 

I need your help with this situation. Here is some information about my project.

NI USB-6501

NIDAQmxBase370, NIDAQ1501f3

Visual C++ 2008, Windows XP

 

What I need to do is:

There is a periodic signal input from the board to my computer.

The input period is ~ 330 ms. The pulse width is ~ 0.7 ms.

I need to deal with something every time the pulse appears.

 

I tried to do this by reading continuously, but some of the pulses were missed because my program can only deal with this data-reading thread every 1 ms.

 

Is there any smarter way to do this please?

 

I would have a help with this if possible.

 

Thank you very much!

 

Best Regards,

 

Liyan

0 Kudos
Message 1 of 3
(3,601 Views)
Solution
Accepted by liyan0329

Hi Liyan,

 

A couple thoughts:
It's not recommended to have DAQmx and DAQmx Base installed on the same computer. DAQmx Base has less features, and can actually override DAQmx as your hardware driver. I would uninstall it and then run a repair installation of DAQmx 15.0.1 to make sure all hardware is recognized properly.

 

If the timing between [trigger received] and [thing done] is important, then this hardware probably isn't the best tool for the job. The USB-6501 is meant for data acquisition rather than software control. Accurately controlling software based on a hardware trigger would require an FPGA solution.

If an "approximate solution" is sufficient, you could read data in 1ms chunks (eg 100 samples at 100 kHz) and parse that array of data for a rising edge. Just search the array for the subarray [False, True]. Make sure to watch out for the possibility of the rising edge being the first data point in an array (the last point of "lastArray" is False, but the first point of "currentArray" is True)

NickelsAndDimes
Product Support Engineer - sbRIO
National Instruments
0 Kudos
Message 2 of 3
(3,572 Views)

Thank you so much!

I will try to find other ways to do this.

Best,

Liyan

0 Kudos
Message 3 of 3
(3,566 Views)