Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

6602 pulse output frequency divide DAQmx visual basic

I need some DAQmx coding help for visual basic 6.0.
 
I would like to take a square wave and place it on the source of counter 0, and produce a pulse on the output for every other pulse that is inputed.  Essentially divide the signal frequency by 2.
 
It is fairly easy using niDAQ Traditional, but I need some vb code examples for DAQmx.
 
I am using DAQmx 8.3 I believe,  should be the very latest.
 
Thanks to any DAQmx or VB Guru's that help.  It is very much appreciated.
 
 
0 Kudos
Message 1 of 4
(3,822 Views)

I don't know any of the syntax for VB calling DAQmx functions, but can describe some options.  I'm surprised you say that it's easy under traditional NI-DAQ -- dividing by 4 or more is fairly easy, but dividing by 2 is more of a special case.   Here are 2 different general ideas.

1. When you configure your pulse generation, set "Units = Ticks" rather than seconds or other time units.  Note that the minimum allowable values for both high time and low time are 2 ticks each.  This would give you divide-by-4 behavior.  So you'll also need to change a relatively obscure property for the counter's output behavior.  The default behavior is "toggle on terminal count."  To perform a divide-by-2, you'd need to make it "pulse on terminal count."  Now instead of toggling state every 2 input pulses (requiring 4 pulses to produce a cycle), you'll generate a pulse for every 2 input pulses.  However, the pulses you generate will be very narrow.  If I recall correctly, they'll be 50 nanoseconds wide, corresponding to one cycle of the internal 20 MHz timebase.  As far as I know, there's no way to change this pulse width.

2. If you know the freq of the input pulses, you could perform a "retriggerable single pulse" generation, where the total cycle time of your output pulse is long enough for you to deliberately miss every other input trigger.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 4
(3,811 Views)
Big Guy,

Thanks for contacting National Instruments.  There are some great resources available when you install DAQmx.  There are many examples in the C:\Program Files\National Instruments\NI-DAQ\Examples\VBasic directory.  Also there is a reference help file dedicated to Visual Basic 6.0.  This is most easily found in the start menu under National Instruments >> NI-DAQ >> NI-DAQmx C API Visual Basici 6.0 Help.

More often than not things that were "easy" they are even "easier" in DAQmx.  I quote the word "easy" since that is relative to the experience of the user.  But I would start with those references and start doing some coding to become familiar with how the DAQmx driver functions.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 3 of 4
(3,809 Views)
Thanks Ken and Kevin.  A combination of both your suggestions helped me out a great deal.  Everything works great now.
0 Kudos
Message 4 of 4
(3,803 Views)