Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a delayed pulse train triggered by external source using VB6

Hello All,

I'm kinda new to DAQ so could use a little help please.

I would like to generate a delayed pulse after recieving a trigger on one of my input channels. I am using PCI6036E series board and Visual Basic 6(No Measurement Studio)

I think I need to use the counter but am having a hard time understanding hot to set everything up. I would like to get my trigger, wait for an amount of time defined by a variable in my program and then generate a pulse with a variable frequency and duty cycle.

I have another question as well?

Is it possible to once triggered to wait some amount of time then send a pulse then wait another amount of time and send a pulse on the same line, or would this require setting up two different counters with different delays?

Any help or advice is muc appreciated.
Thanks
J
0 Kudos
Message 1 of 2
(2,669 Views)
Hello J,

The first thing I would recommend is to take a look at the NI-DAQmx text-based example programs, in order to get an idea of how to program a pulse generation task.  These examples should be installed by the NI-DAQmx driver in the following directory on your machine:

C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Generate Pulse

The DAQmx function names are the same across all text-based programming languages.  I would also recommend the NI-DAQmx C Reference Help for descriptions of individual DAQmx functions, located at Start > All Programs > National Instruments >> NI-DAQ.

For a triggered pulse generation, you specify a PFI line to receive the trigger using the DAQmxCfgDigEdgeStartTrig function.  When configuring your task using the DAQmxCreateCOPulseChanFreq function, there is an input for 'initial delay' that sounds like what you are looking for.  Take a look at the example program title DigPulseTrain-Cont-DigStart.c for an idea of how to use these functions.

To answer your second question, you might be able to accomplish this with the DAQmxCreateCOPulseChanTime function.  This function is used to specify the specifications of your pulse in terms of high and low time, instead of through frequency and duty cycle as shown in the DAQmxCreateCOPulseChanFreq function.  You could specify an initial delay for the first delay, specify a high time for your first pulse, specify a low time for the delay between the first and second pulses, and then your second pulse would have the same high time as your first pulse.  You might need to play with the 'idle state' parameter to get this to work, but it seems like it should be possible to do this all on one line.

Take a look at these resources to get started, and let us know if you have any further questions as you go.  Good luck with your applicaiton.

Regards,
Travis G.
Applications Engineering
0 Kudos
Message 2 of 2
(2,663 Views)