Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Event on pulse width below / above a threshold

Hi,

I am using a PCI 6602 for sampling 5 sensor outputs. The sensors measures distance and output a pulse at a frequency of 50kHz. The pulse width is inverse proportional to the measured distance. Now, I can easily sample the pulse width using DMA for three of the sensors but unfortunately any other data transfer mechanism is to slow. That means that I do not have the ability to sample the last 2 sensors. I use pulse width task for this.

With the other 2 sensors I could do without getting the actual distance (pulse width) as long as I get an event or any other notification when the pulse width gets over/under a certain threshold. I.e. a notification when a transition from one level to another takes place. Can this be done or do I need to implement it using 2 cards?

 

For an example.
When the pulse width is below  a threshold T (PW < T) and goes above (PW > T ) an event is fired. As long as the pulse width remains longer than T nothing happens. Once the pulse width goes below (PW < T) the event is fired again…

 

BR

Jongas

0 Kudos
Message 1 of 4
(6,057 Views)

Hi Jongas,

 

Instead of using implicit timing which would require you to transfer a sample after every pulse-width is measured, why not use on-demand sampling on the extra 2 counters to poll the current position of your sensors on these channels?

 

 

Best Regards,

John Passiak
Message 2 of 4
(6,051 Views)

Hi John,

Thanks for your reply.

I'm not quite sure I understand your suggestion.

Do you suggest polling the sensor output at 80MHz?

Ï'm not quite sure how that would help me. Could you elaborate.

 

Basically I need to know 2 things

When a pulse width threshold is exeeded or reverse.

When this transition occurre (relative to other sensor transition).

 

I'm using .NET API

 

BR

Jongas

0 Kudos
Message 3 of 4
(6,039 Views)

Hi Jongas,

 

On your hardware approach for the first 3 channels I am assuming you are:

 

    - Using an Arm Start Trigger in order to synchronize the start of all 3 channels

 

    - Configuring implicit timing such that you get 1 sample at the end of every pulse width (1 sample per counter every 50 kHz).

 

    - Synchronizing the signal from the sensors such that the pulses are lined up with some 50 kHz clock

 

The end result of this is that you have an array of pulse widths that is deterministically synchronzied between the three channels.

 

Now, I'm not sure if a SW event really fits into this.  I guess what I was thinking is if you just poll the pulse width of your sensors (certainly not at 80 MHz) with a software-timed Pulse Width task you can measure the time that the signal exceeds your threshhold with a resolution on the order of miliseconds.

 

If this is not acceptable I believe you will have to purchase additional hardware.  If you only need 2 additional DMA counters, an M series board would be suitable.  If you have a PCIe slot available you'd probably want to get an X Series board instead.  Of course, another TIO board should work as well if you prefer.

 

 

On a side note, I did try to come up with a solution using the 5 remaining counters on the 6602 to get deterministic measurements of when the threshhold is crossed, but I can't think of a way that will let you know when the threshhold is crossed in both directions.  I am not even sure if a solution is possible to alert you every time the threshhold is crossed in one direction, but I didn't put as much thought into this scenario since it is not what you were asking for in any case.

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 4
(6,022 Views)