Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to multiple digital lines using USB 6229

Hi All,

I am trying to write to two seperate digital lines on port 0 using the USB-6229. The lines I am trying to write to are line 0 and 1. I would like to write two seperate digital patterns to these lines as indicated by the VI attached, i.e. pattern & pattern2. I create a new 2D array from the two 1D arrays shown on the front panel of the VI to output on two digital lines.

I have selected "Digital 2D U32 N Chan N Sample" on the Write DAQmx task.

When I run this VI, pattern2 (00001111111) is output on port0/line0 but the other pattern is not output on line 1 on port 0.

Would anybody know why this is happening and also how I could fix this issue so that pattern2 (00001111111) is output on line 0 and pattern (11110000000) is output on line 1?

Thanks for taking the time to read this.

Michael.
0 Kudos
Message 1 of 2
(3,084 Views)

Hi there,

You have set up the output to be written in port format (specifically U32)  This means that if you were to write a single U32 to the write function it will populate all of the 32 lines in that port with the appropriate value in binary (line0 = 1, line1 = 2, line2 = 4 etc).

You need to either, set up to write in line format, or do a little more bit bashing.

Firstly write all the arrays to be U32's instead of U8's.

Then instead of using the build array, use an OR function. (Not forgetting to multiply the line1 values by the value 2^1)

Finally, because I am assuming you won't use more than 32 lines, change the DAQmx write function to write to a single channel (32 lines in port format are a single channel) multiple samples output.

Here is a screen shot.

Hope this helps

AdamB

Applications Engineering Team Leader | National Instruments | UK & Ireland
0 Kudos
Message 2 of 2
(3,070 Views)