Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate and output 3 TTL square waveforms with different pulse widths using counters of NI 6034E

Hello
I just have a few questions.

 I am using the NI 6034E DAQ board in order to generate simultaneouly 3 different TTL digital signals, with different pulse width, and output these TTL signals to an external circuit that I am using for this application.

The following pattern of the TTL pulses will look like this:
01010101 01010101
00110011 00110011
00001111 00001111

From what I understand,  I have to use the 2 counters, Ctr0 and Ctr1, to generate the TTL pulses that I desire, because the DIO lines are software timed only and I will not be able to produce a deterministic output period using these DIO lines.  Am I correct?    Also, do I have to use a separate counter to generate a separate TTL digital pulse.  I need 3 different TTL pulses and there are only 2 counters for this DAQ device.  The three generated TTL signals will be feed to an external circuit.  Concerning the hardware connections for my application, I assume that the generated TTL signals will be output from GPCTR0_OUT(pin 2)  for counter 0 and GPCTR1_OUT(pin 40) for counter 1 of the NI 6034E. Is this correct?  Is there any way that these TTL signals can be output from three DIO lines(DIO0...2). 

Here is some code that I plan to use in order to do this:

 #include <NIDAQmx.h>
static TaskHandle gTaskHandle = 0;
DAQmxCreateTask ("", &gTaskHandle);
DAQmxCreateCOPulseChanTime (gTaskHandle, "Dev1/ctr0", "", DAQmx_Val_Seconds, DAQmx_Val_Low, 1.0, 2.0, 2.0);
DAQmxCreateCOPulseChanTime (gTaskHandle, "Dev1/ctr1", "", DAQmx_Val_Seconds, DAQmx_Val_Low, 3.0, 4.0, 4.0);
DAQmxCreateCOPulseChanTime (gTaskHandle, "?????", "", DAQmx_Val_Seconds, DAQmx_Val_Low, 7.0, 8.0, 8.0);

DAQmxCfgImplicitTiming (gTaskHandle, DAQmx_Val_FiniteSamps, 5);
DAQmxStartTask (gTaskHandle);
DAQmxWaitUntilTaskDone(gTaskHandle)
DAQmxErrChk DAQmxStopTask(gTaskHandle)
DAQmxErrChk DAQmxClearTask(gTaskHandle)


I believe this code should generate the 3 TTL square waveforms that I want for my application.

Please provide me with some feedback.  It would greatly be appreciated.
Thank You

   
0 Kudos
Message 1 of 3
(3,556 Views)
 

 Hi,

The NI 6034E is a multifuntion DAQ device, this means you have:
  (2) counters
  (8) DIO lines (software timed)
  (16) AI, single ended
  (0) Analog Output

 You have a couple choices here:
   1. Software timed digital output of all three signals, max 1khz loop rate, non-deterministic.
   2. Hardware timed digital output of 2 signals, max 20Mhz.
   3. Hardware timed digital output of 2 signals and software timed digital output of 1 signal.
   4. Find another NI MIO board such as the NI 6251. This board will do 10Mhz pattern generation for (8) DIO lines.

For the hardware connection, you are correct, the output for the counters will be taken from pin 2 & pin 40.  Here's the pinout for the NI 6034E for reference:
 

The output of the Counters can be routed to some of the PFI's or to the RTSI connector. You can see this in MAX






 



Message Edited by Matthew W on 11-19-2007 01:24 PM

Download All
0 Kudos
Message 2 of 3
(3,534 Views)

To finish my post from earlier:

Measurement & Automation Explorer will tell you where you can route the Counter outputs to:
 

I would advise looking at the ANSI C examples for DAQmx, these are complete, ready to run examples with the right syntax for everything.
The locations of these examples is detailed in this KnowledgeBase article.

The code looks correct, I would start with the shipping examples, ensure that you can get them to run as designed then modify them to suit your specific needs.

Best regards,

MatthewW
Applications Engineer
National Instruments


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