LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx, DO pulse only works on Port0/Line0

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.

2017-10-30  LabVIEW DO as pulse.png

0 Kudos
Message 1 of 15
(3,895 Views)

Hi Tera,

 

what's the problem with port0/line0 when you want to use an ordinary digital output?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 15
(3,865 Views)

I need to use a different line on that port. Port0/Line0 is already used by something else.

0 Kudos
Message 3 of 15
(3,860 Views)

Ok, then choose a different line.

What is your problem with this?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 15
(3,856 Views)

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.

0 Kudos
Message 5 of 15
(3,851 Views)

What happens when you use MAX to test your device?

What happens when you use the testpanels in MAX to drive those other DO lines?

Is your device tested and ok?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 15
(3,848 Views)

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.

0 Kudos
Message 7 of 15
(3,832 Views)

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.

0 Kudos
Message 8 of 15
(3,823 Views)

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

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 9 of 15
(3,822 Views)

Hi Tera,

 

do you get the same behaviour when you use the example VI for "DAQmx digital output, finite output"?

 

Ah, Alexander and Kevin pinpointed the problem…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 15
(3,820 Views)