Discussion:
How to use HSDIO to count rising edges of us pulses?
(too old to reply)
Nige K
2006-06-14 11:10:08 UTC
Permalink
Hi,
 
I am very new to HSDIO and am struggling at the moment to do what I am sure must be a very simple operation.
Currently using:
PXI-1031, PXI-8187, PXI-6552, Labview 7.1 Full Dev with RT module.
 
I have produced a vi which effectively triggers of a pulse and then counts the number of incoming pulses which arrive within several different timing gates. This works as I would like but for testing purposes I produced the pulses my self by pressing the button within the vi.
 
I now want to take this to the next stage and link this vi the the actual data pulse train that I will be measuring.  This pulse train will be a random series of ~0.5us pulses and could last indefinitely, i.e. >60mins. I have no need to physically record the pulses and save it at this present time but I need to be able to count each individual rising edge, effectively replacing my manual pressing of the button by the experimental pulse train generated by my apparatus.  However, I have no idea how to proceed with this.
 
Could anybody out there guide me as I am struggling to get to grips with HSDIO programming?
 
Many thanks in advance,
 
NigelMessage Edited by Nige K on 06-14-2006 06:09 AM


Multiple Feynman Variance 2.vi:
http://forums.ni.com/attachments/ni/70/5050/1/Multiple Feynman Variance 2.vi
Ryan M
2006-06-15 15:10:16 UTC
Permalink
Nigel,

You could have used the multi-record feature of the HSDIO driver to
count edges.  You could use the rising (or falling) edge of your
pulse as a multi record advance trigger and use an attribute to
determine how many records have been fetched.  In this fashion,
you would be counting edges and ignoring the duration of the
pulse.  However, there is a minimum amount of clock cycles for
this trigger to rearm (~140samples) so at 100MHz, the rising (or
falling) edges could not be closer to one another than ~1.4us.

Your method of just capturing the pulse train and post processing it is
certainly valid.  There are certain caveats to this method in
regards to streaming the data.  In order to capture more data than
your memory can hold (as in very long acquisitions), you must be able
to fetch data out of the memory faster than you're putting it in. 
This can be done and benchmarked but is very system dependent as your
are now pushing data across the PCI bus which is inherintly
slower.  You can get better performance by using the "Data Width"
attribute to be more efficient with your memory usage.

You could also use your gating signal as a Pause Trigger and capture
only the pulses that occur when your gate signal is deasserted. 
In this fashion, when your gate is asserting the Pause Trigger, the
acquisition sessions stops putting data into memory.  When the
gate deasserts Pause, the data then gets stored.  This will allow
you to store only "qualified" data and give you better memory
utilization.

Alternatively, NI HSDIO 1.4 introduced some new Hardware Compare
features.  There is a white paper available for this new set of
features
(http://zone.ni.com/devzone/conceptd.nsf/webmain/15de80989fd122188625704d007885ea). 
The feature that could be of use to you is the error count.  I
would suggest using a Response mode without the stimulus.  This
allows you to use an acquisition Pause Trigger as described
above.  You would then generate "expected" data of L (for rising
edge detection; H for a falling edge detector) on the channel to which
is connected your pulse train.  When the data on your gate is 1
(NOT paused) and on your pulse train is 0, then there is no
error,  When the pulse train transitions to 1, the hardware
will generate an error.  If you turn on the "FilterRepeatedErrors"
then the hardware will only store the first error of a consecutive set
of errors allowing you to only register/count the first occurance (the edge)
rather than the errors that occur in the duration of the pulse. 
When the gate drops to 0, the comparison will pause so you will no
longer count or record errors.  There is no rearm time required
for this operation and will give you the best memory utilization and
response time of the methods I've brought up so far.  This is a
little trickier in that it is a departure from the "classical" digital
applications but once you use the features a couple of times and read
through the white paper it becomes second nature.

Please let us know if you have any questions

-Ryan M
Message Edited by Ryan M on 06-15-2006 09:51 AM

Loading...