To download NI software, including the products shown below, visit ni.com/downloads.
To execute this example:
Requirements
Software
LabVIEW 2012 or compatible
NI-DAQmx 16.0 or compatible
Hardware
cDAQ with C series Digital IO Module
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Hello I am Antonio Smith. This is a great example. I'm trying to use it, but I am keep on getting this error:
Do you believe you can help me?
What error are you getting? It didn't seem to come through.
It's a good example! I'm trying to add phase input to the VI by modifying the square wave sub-vi to give 120 degree phase shift for the output three signals, but without ant luck. Does ant one know how to modify the above VI to have phase shift feature?
Try looking at this example (one of the download links includes phase settings). It's analog output instead, but it should be easy to convert the analog output signal into a digital one like I did in the example on this page. Building the waveform in this way is certainly not the most efficient, but the simplicity is nice.
I modified the example you stated to generate 3 analog signals with 120 degree out of phase and worked well. The only thing I don't like is the slew rate with analog pulses; thus, I was trying to the above VI and add the PHASE terminal in the square wave sub-vi and than create a Phase control on the front panel. I step through the operations, phase data feed to the Square wave sub-vi fine but for some reason, no phase info comes out. I looked through the Square wave sub-sub-vi too, but couldn't find any problem there. Any suggestion is appreciated.
You should be able to configure the analog wave form to "square wave" as the example is currently written (the "Basic Function Generator.vi" allows you to specify the waveform type). You can use the same logic as "Generate PWM.vi" attached on this page to convert the analog waveform into a digital one for use with digital output lines.
Hello,
I am extremely interested in using this example, but I keep getting the error message listed at the bottom of this post. I assume it is an issue with the sample clock, but I cannot fix it. As far as I can tell, my device *should* be able to handle an output clock and I have tried leaving the "select clock source" blank to use to the device's internal clock, selecting "onboard clock," and selecting individual lines that appear in the dropdown menu. The device works fine for other examples I have tried, although admittedly I have been unable to get a multi-channel output working with a sample clock- which is why I downloaded this example in the first place. If there is any help you could offer it would be most appreciated.
sincerely,
~ Sarah
Error -200846 occurred at Cont Gen Dig Wfm Non Regeneration Mult Channel.vi
Possible reason(s):
Write cannot be performed when the auto start input to DAQmx Write is false, task is not running, and timing for the task is not configured or Timing Type is set to On Demand.
Set auto start to true, start the task, or configure timing and specify Timing Type other than On Demand.
The problem is that you write to the DAQ before you call the VI that starts the DAQ. I have moved that VI to before the "DAQmx write" and that solve this i problem. But then I encountered a new problem...
The write has to occur before starting the task. This configures the output buffer.
The only way I could see Ember5 getting that error is if she deleted the part of the code that configures the sample clock timing. This of course is mandatory as well.
John_P1, here is a screenshot of my code, and i get the same error as Ember5. Any clue?
And also does the "lines" on the wavechart graph first appear when the code is running?
Hello John,
I'm trying to impletment your sample on my device. I kept getting the error 200898 as follows:
"
Possible reason(s):
Partial use of physical lines within a physical port is not supported by this device, given the requested Sample Timing Type.
Consider specifying the entire port and tristating the lines you do not want driven.
Property: SampTimingType
Requested Value: Sample Clock
Output Channels: PXI1Slot2/port0/line0, PXI1Slot2/port0/line1, PXI1Slot2/port0/line2
Task Name: _unnamedTask<145EF4>
"
Do you know where this error comes from and how to fix it? I didn't modify the block diagram. Only the front panel.
You are amazing, your code is amazing and you should feel good about yourself.
Saved me quite some time.
Hey, John, thanks for the example code! I've been trying to get this functionality on my DAQ for the longest time. That said, I do have some questions about the PWM part of the code. For my project I need to create 3 digital waveforms for 3 separate lines, two of which are identical and one that runs at twice the frequency of the other two. This is easy enough to do with what you've provided, but I need the two identical waveforms to be offset such that when one is high, the other is low.
I know NI-MAX allows you to invert lines when creating tasks; is there any way to modify this example to include a similar functionality?
Thanks in advance.
Hello,
I could not able to find the PWM subvi to use this code. Can anyone share it with with me?
Thanks.
Dear sir,
I want to write a program where there will be 3-4 channels to generate digital outputs which can be started and stop at a specific time. When I try to do it for two then only one channel is getting started but the other is showing ERROR-50103 as both the channels are using the same clock which is the onboard clock. We are using PXI 6361. Can you please help me to solve this issue? I am attaching the Vi s here.