10-30-2017 11:43 AM
I have an NI USB-6363. I had a need to generate a 50% duty cycle pulse using a digital output instead of a counter output. It works great except that I only see pulses out when I use Port0/Lin0. I am somewhat new to DAQmx.
10-30-2017 01:59 PM
10-30-2017 02:02 PM
I need to use a different line on that port. Port0/Line0 is already used by something else.
10-30-2017 02:03 PM - edited 10-30-2017 02:03 PM
10-30-2017 02:07 PM
Sorry if I'm not clear. I tried a different line. I tried several different lines. If I choose any other line than Port0/Line0 then I don't see any pulses on the output pin. I do not get a DAQmx error.
10-30-2017 02:13 PM
10-30-2017 03:04 PM
Thanks, I don't think hardware is the issue. It brand new and I also can turn on and off other digital output lines using a different DAQmx method. I just need a better way to pulse. So this is what I came up with. There is something about the particular method I posted that only seems to work with Port0/Line0. For instance if I set the line to Port0/Line1 or even Port0/Line17, I do not get pulses out. I want to use this method or similar because I can pulse to output much faster and with less jitter than if I use a single digital command and a software loop to toggle it.
10-30-2017 03:15 PM
hmm, and what are you sending to the port? The same 0 - 1 - 0 - 1? I guess if it is "port output", you need to send 0 - 2 - 0 - 2 for port 0 line 1.
10-30-2017 03:15 PM
I think you might just need to write a 1D array of booleans (1 channel N samples) instead of a 1D array of U32 integers. You might possibly also need to change the config setting to "one channel for EACH line".
When you write U32 data to the task, it gets mapped in a bitwise fashion to all the lines in the port. Bit 0 corresponds to line 0, bit 1 to line 1, etc. This will be true even if Bits 0, 1, 2, etc. aren't in the task. If you want to write to line 2, you'll need your U32 array to toggle between values of 0 and 4 because the value 4 corresponds to bit 2 and line 2. I'll bet your array toggles between values of 0 and 1, meaning it only toggles bit 0, and *that's* why it only works on line 0.
All this stuff is easier to deal with if you write a 1D array of booleans with only 1 channel in the task. Then the values are mapped to whatever channel was assigned to the task. I tend to avoid the U32 port writes for this reason. With Booleans, you send the same 1D array of values no matter what line you configure for the task. With U32's, the array of values needs to change when you configure a different line for the task.
(Note that when writing the U32 array, internal masking will prevent the task from actually changing DO signals on lines that aren't part of the task.)
-Kevin P
10-30-2017 03:17 PM - edited 10-30-2017 03:19 PM