From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate digital output on 32-bit port

Solved!
Go to solution

Hi all, any help appreciated with the last (!) step in a very time consuming puzzle...

 

I have a PCI-6254 card with 2 x 64 channel breakout cables. Each cable goes to a remote box, each of which essentially runs a multiplexer and acquires analog signals.

 

Each multiplexer needs an array of  4-bit addresses (eg. 0 to 15) to cycle the multiplexer channels, which I can succesfully generate on port0\line0:3 which are found in cable 1 going to box 1.

 

My mission is now to duplicate this digital signal in the second cable going to the second box. For this card, Cable 1 has port0\line0:7 and cable 2 has port0\line8:31. I understand that it's a 32-bit port, so I need to send it a 32-bit address.

 

So I simply (!) want to send identical digital outputs on port0\line0:3 and on (say) port0\line8:11. They should be triggered by the same clock, etc.

 

Is this possible? However I try so far I can only generate an output on lines 0:3. From what I've read, I'm wondering if the whole of the port is tied up by writing a 32-bit number to the first 4 lines....

 

Thanks!

 

0 Kudos
Message 1 of 6
(3,173 Views)

Hi Dave,

 

yes, that's possible!

 

Simply create a DAQmx task for "Dev1/di0:3, Dev1/di8:11" to have 8 digital lines in your task…


The other option is to use the whole port and just set the bits/lines you need in your U16/U32 word!

Best regards,
GerdW


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

I'm wondering whether you select all needed channels for the task you create. You can try to create separate tasks also, for example, with needed lines groups, like here:

DO.png

0 Kudos
Message 3 of 6
(3,149 Views)

Thanks both, really appreciate your input. I think I tried something like that today with no success but maybe I did it wrong. It ran without errors but just generated the output on 0:3. I'll try your suggestion in the morning (New Zealand evening now).

 

I think I need to replace the 1D boolean with a 1D U32 array to send the right bit address (I am sending the mux channels in a funny order, something like 4,0,3,6,10,etc). But then I fear that it will only run one task, as the whole 32-bit port is being addressed each time.

 

GerdW - could you explain how I would go about setting the right bits to send, say, a value to 4 to both sets of lines? I can't get my head around it...

Thanks guys!

0 Kudos
Message 4 of 6
(3,123 Views)
Solution
Accepted by topic author Dave_Le_Pelley

Hi Dave,

 

a very simple (and not optimized) way:

check.png

Create your 4 booleans for the first 4 lines in the port and set them twice in a boolean array for the whole port.

When you want to optimize this you only need to use integer numbers and some simple math…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 6
(3,113 Views)

Done - thanks GerdW!

 

I set up a task using the whole port and then ran your snippet in a loop for each of the U32 addresses I need to call. Then I converted the Boolean array back to a U32 number for each, then used DAQmx Write with U32, 1 Chan NSamp to write the integer array.

 

Many thanks, and Kudos richly deserved for such a speedy solution.

Dave

0 Kudos
Message 6 of 6
(3,013 Views)