07-17-2025 04:04 PM
I am using the Python API for NIDAQmx to control digital output to a PCI 6534 card. The goal is to generate 8 different pulse trains and output them to 8 separate channels simultaneously. My current program is set up to generate an 8x5,000,000 point array and output that at a frequency of 1,000,000 (essentially 5 seconds of 1 microsecond data points), adds each line of port 0 to the task individually, and then uses a DigitalMultiChannelWriter to write the each row of the array to the corresponding channel, with an external timer to cut it off after 5 seconds. It correctly outputs the pulse train for port0.0, but all other lines have two problems:
1. They all follow the pulse train assigned to line 0
2. They all very briefly pulse on line 0's rising and falling edges. They don't remain high for the pulse width I am expecting (nor do they really stay high for any measurable period of time)
I have no idea what I am missing so that the other line output their corresponding array row. According to the API the data rows should just correspond to the order you add the channels to the task when using write_many_sample_port_byte(data, timeout=10.0):
"data (numpy.ndarray) –
Contains a 2D NumPy array of 8-bit unsigned integer samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel. The order of the channels in the array corresponds to the order in which you add the channels to the task."
I've included my program file as well as an image of the oscilloscope output to better show that the first line is correct but second line doesn't do what it should.
(I've also extensively tested the wiring so I know it is not an issue with the wire being in the wrong DIO port or an issue with the oscilloscope)
07-29-2025 06:11 AM - edited 07-29-2025 06:31 AM
Are you sure your wiring is properly done? This looks more like instable ground swing and/or signal cross talk.
While I never used Python to do NI-DAQmx, if I want to use multiple digital IOs synchronously, I never setup individual boolean channels per line, but instead control the entire port with a single integer per sample, with the according bits in the integer set as desired. LineGrouping.CHAN_FOR_ALL_LINES
Also, have you tried to at least configure the channels with a single "PCI_2007/port0/line0:7". Not sure the Python interface supports this syntax but the underlaying C interface does.