Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to multiple digital lines separated by comma

Solved!
Go to solution

Hello folks,

 

I am using a USB-6009 and want to write to multiple digital lines created in the comma separated  style:

 

error = DAQmxCreateDOChan(taskSelHead,"dev3/port0/line0,dev3/port0/line6","",DAQmx_Val_ChanPerLine);

 


When I try to write to this channel I do
 

uInt8 data[8] = { d1, 0, 0, 0, 0, 0, d2, 0 }; // with d1 and d2 representing 0 or 1, that bits I want to get written

int error = DAQmxWriteDigitalLines(taskSelectFilter, 1, 1, 10, DAQmx_Val_GroupByChannel, data, NULL, NULL);

 

The result is, that only line0 gets  updated, lin6 stays 0.

 

I also tried DAQmxWriteDigitalU8 with the same effect.

 

Can anybody help ?

 

Thanks in advance,

 

Michael

0 Kudos
Message 1 of 3
(3,009 Views)
Solution
Accepted by topic author michael_b

Hi Michael,


you defined two dig.out channels in your Task: line 0 and line 6. So when writing an array of channel values, d1 gets mapped to your line 0 all right - but line 6 always receives a zero!

Have you tried defining uInt8 data[2] = {d1, d2} ?

Best regards,
Sebastian

0 Kudos
Message 2 of 3
(2,993 Views)

Hi Sebastian

 

In fact I have tried it before, but somehow screwed it up or didnt recognize it as working. 

I retried your solution and now it works.

 

Thanks a lot!

 

Michael

0 Kudos
Message 3 of 3
(2,979 Views)