08-08-2018 09:51 AM
Hi!
I'm trying to generate a continuous arbitrary (not a square wave) TTL pulse train on three digital outputs using a USB-6259 DAQ. I attached a drawing of the pulses I want to implement.
After trying to implement this with one digital channel at first (for example, Port0/Line0 or Port1/Line0), and trying to modify the LabView example "Digital - Continuous Output.vi", I was unsuccessful. I'm able to toggle these outputs on/off in the NI-MAX Digital I/O Test Panels.
Do you have some recommendations for how to implement this? I'm about to try programming an arbitrary waveform with analog channels, though this seems like it's not the best solution.
Thanks for your help!
08-08-2018 10:16 AM
The manual says that only Port 0 can do continuous output...
I would crate a Digital output task in MAX for the first port and poke a the setting for that task until you have it doing a continuous DO task.
Then save the task with a name you will remember.
Create a new VI and then trop a DAQmx task constant on the diagram.
Right click it and select "Generate config and example"
LV will then script up an example VI. It should do the same thing as it did in MAX.
From that point it is up to you to generate the waveform you want and keep the update going and ensure the task does not run out of data.
Ben
08-08-2018 02:23 PM - edited 08-08-2018 02:24 PM
Thanks for the feedback - I made some headway. I attached a screenshot of an example VI that almost satisfies my requirements. Using the 20 MHz timebase and 'N samples', it writes 100 digital levels (stored in the array of three waveforms called 'pulse array'). I made this partial solution by adapting the output of a DAQ assistant VI.
I have a follow-up question: how can I make this pulse train repeat after it's finished? Unfortunately while the 'N samples' works, I can't get 'Continuous' samples to work due to this error:
"
Error -200621 occurred at DAQ Assistant
Possible Reason(s):
Onboard device memory underflow. Because of system and/or bus-bandwidth limitations, the driver could not write data to the device fast enough to keep up with the device output rate.
Reduce your sample rate. If your data transfer method is interrupts, try using DMA or USB Bulk. You can also reduce the number of programs your computer is executing concurrently.
"
Can you suggest how I can re-run the same pulse trains continuously (without gaps) forever?
Thanks again!
08-08-2018 05:56 PM
Hmm, I was able to make an example VI that outputs a finite number of samples (screenshot attached).
What's the best way I can make this run continuously, repeating the pulse sequences over and over without gaps?
Thanks again!
08-08-2018 06:45 PM
On the "Sample clock" set it to "continuous samples" instead of "finite", and instead of the "Wait" VI that's the second to last entry, put in a While loop with some sort of conditional (or anything else that waits until you're ready to stop, really).
08-15-2018 04:26 PM
Thanks for the recommendations. I tried your suggestion (screenshot below) and changed Sample Clock to 'Continuous'. I think now the DAQ runs the pulse sequence several times, but not continuously.
Some details:
- Using my oscilloscope, I can see that the DAQ outputs a finite number of pulse trains. The total number of pulse trains varies each time I run the VI. Sometimes it runs 23 times, other times 28 times, and other times something in between.
- Despite running a finite amount of time instead of continuously, the final output states (voltages) seem to be the same for each attempt.
- The "DAQmx Write" VI throws a warning with error code 200036 (not hooked up in the screenshot below). It still runs though, just not continuously.
Perhaps I'm still doing something silly in the code ... Do you have any ideas?
Thanks again!
08-15-2018 06:01 PM
Put a "DAQmx Is task done" VI in your While loop and stop on that reading True as well as your button press. Make sure to wire its error chain so you get out any errors that cause it to stop early.
At a guess I think you might need to switch to a different clock and/or sample rate on your sample clock setup. 20 MHz on 3 channels is a lot of data and if your system can't keep up it might well run for a few times then terminate.
08-21-2018
10:01 AM
- last edited on
06-05-2025
03:15 PM
by
Content Cleaner
Issues:
1. You really should get in the habit of wiring your error in/outs. Locating where an error gets thrown is typically the first line of inquiry when troubleshooting.
2. When an error *does* occur (such as the -200036 error you mentioned), pay attention to the error text. It tells you that the 20 MHz sample rate you're requesting isn't supported by your device. Your device is limited to a max rate of 10 MHz.
3. Further, your M-series 6259 device cannot generate its own sample clock internally from one of the board's timebases. You need to do "correlated DIO" where the sample clock is provided from some other source. (The linked example uses a clock generated by the AI subsystem. I'd recommend you generate such a clock with one of the board's counters instead to support higher clock rates up to 10 MHz.)
-Kevin P
08-27-2018
02:28 PM
- last edited on
06-05-2025
03:15 PM
by
Content Cleaner
Thanks for the great feedback. I was able to make the following VI work with my USB-6259 DAQ (screenshot attached below). I'm using the 100 kHz clock, and so far it seems to work great!
Now I'm testing this with another DAQ (USB-6210), but the code doesn't seem to work. Comparing the spec sheets for USB-6259 and USB-6210, both have the 100 kHz timebase available. However, the DAQmx Timing (Sample Clock) subVI throws an Error -200077 ( Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.)
Datasheets:
https://www.ni.com/docs/en-US/bundle/usb-6210-specs/page/specs.html
https://www.ni.com/docs/en-US/bundle/pci-pcie-pxi-pxie-usb-6259-specs/page/specs.html
I have two questions:
1. How do I identify which DAQ can run this specific (or any related) code? What specs in the datasheet should I be looking for?
2. Is it possible for a USB-6210 DAQ (or other DAQ models) to also generate continuous digital pulse trains.
Thanks again!
08-31-2018 10:56 PM
I was surprised you got either device to work when specifying the 100 kHz timebase as the sample clock. I did not think that M-series boards could be configured that way. A little further digging with simulated devices and the "Device Routes" tab in MAX revealed that DAQmx makes internal use of Ctr0 to allow routing from the internal timebases to the DO sample clock circuitry.
So while I was kinda technically right that the DO system can't make a sample clock for itself, it appears that the DAQmx driver *can* and *will* do some things behind the scenes to accomplish a similar result. What's not fully clear to me is whether the method you used would allow you to choose arbitrary sample rates or whether you can only use rates equal to the internal timebases.
If you configured your own counter pulsetrain and then configured DO to use it as its sample clock, you'd for sure have full flexibility in choosing the rate. Now onward to your specific questions...
1. The key thing to notice is that the 6259 spec sheet for DIO mentions "Waveform Characteristics" on Port 0 while the 6210 does not. The use of the term "waveform" implies hardware clocking and the fact that the 6210 doesn't mention it means that hardware-timed DIO isn't supported.
2. The 6210 will *not* be able to generate hardware-timed digital signals on 3 lines at once.
If you need to buy something, I'd point toward an X-series board (63xx). Most (or maybe all) of them can support hardware-timed DIO directly. They also have 4 counter/timers that support pre-defined variable freq pulse trains.
-Kevin P