LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI PXI-6528 programming

I want to do a loopback test for a NI PXI-6528.  It has 24 isolated input channels and 24 isolated output channels.  I have a fixture that allows me to wrap each input pin to each output pin.  So, bit 0 of Port3 (output) is wired to bit 0 of Port 0 (input).  Ports 3,4,5 are outputs and Ports 0,1,2 are inputs.  I'd like to basically walk a one down the 24 output bits and read each one individually at it's respective input.  I setup two DAQmx Assistants (two tasks?) such that each task contains the individual channels (24 bits) of the input/output.  The code I've attached is nowhere near complete, but merely a snippet of what I'd like to do.  Ultimately, I'd like to automate this test, but initially, I'd like a control, say a 24 value boolean array that corresponds to each output bit, and a similar one for the input bits.  I'd like to set a bit (or several) and say 'write' and see the respective Input booleans light up.
 
Can someone shed some light on how I can have bit level control of the I/O?
Download All
0 Kudos
Message 1 of 21
(4,167 Views)

I can't view your code and I would never use the DAQ Assistant. Walking a one is pretty simple. This is how I would do it. If you configure the DAQmx Write a little differently, you can wire the number to the data input instead of a Boolean array but I did this way because visually, it's what you asked for. From this, you should be able to add the DAQmx Read and do a comparison.

Message Edited by Dennis Knutson on 10-27-2006 03:05 PM

0 Kudos
Message 2 of 21
(4,160 Views)

I went with the DAQmx assistant because I can't really find any good documentation on the proper order of events. 

For example, do I have to create separate tasks for the Inputs and outputs?

Is the task valid for the duration of the VI

Is there any typr of close operation I need to perform at the end

How do I create the (drop down) list of output channels that feeds into the write.

How do I specify which channel I want to read

Should I use Line I/O or Port (ultimately I want to control one line at a time)

0 Kudos
Message 3 of 21
(4,143 Views)

Have you read the DAQmx help or the "LabVIEW Measurements Manual" that is part of the LabVIEW bookshelf? There's a lot of resources available on the NI Developer Zone as Well. I would recomend you do a search.

Yes, you create a separate task for each.

The task is valid until you use the Clear Task function.

Yes, eventually you will need to stop the task and then clear it.

Write click on the DAQmx Create Channel physical channels input and select 'Create Control' or 'Create Constant'.

Specify the channel in the physical channel list or create a task in MAX.

It's more convient to use line I/O if you want to control a specific line or set of lines.

 

0 Kudos
Message 4 of 21
(4,140 Views)
I had the DAQmx assistant generate code for both the input & output tasks.  I then added some of the code you suggested in the previous message.  Any idea why it would think the channel number in data vs task is different?  I don't actually compare the output and what's read at the input yet, primarily because I'm not sure how.  In general, I'm not sure how to (outside of a looping construct) specify one particular output and one particular input.
Download All
0 Kudos
Message 5 of 21
(4,121 Views)
I made a mistake when I converted from my original which took a numeric as an input to the change to take an array of Booleans. The original is based on the shipping example called Write Dig Port. With that, the output of Power of 2 can be wired directly to the data pin of the DAQmx Write. With the conversion to a Boolean Array, the default array size is one of 32 elements. You can simply use the Array Subset function to pass an array of 24 elements to the DAQmx Write.
0 Kudos
Message 6 of 21
(4,110 Views)
Since I'm writing one bit at a time, is there any advantage to writing the number vs boolean?
0 Kudos
Message 7 of 21
(4,107 Views)
I don't think there is any difference. It's just a matter of representing the same data in a different ways. A point of clarification though. You are writing 1 bit of 24 high at one time which is not the same as writing only one bit at a time.
0 Kudos
Message 8 of 21
(4,103 Views)

I'm not clear on where the error is.  I did the snippet below and it was successful whether I set the For-Loop count to 24 or 32.

 

0 Kudos
Message 9 of 21
(4,078 Views)
I ended up placing a Diagram Disable Structure around the call to DAQmx Clear Task.vi located after the For-Loop, and the error no longer appears.
0 Kudos
Message 10 of 21
(4,079 Views)