11-23-2010 04:34 PM - edited 11-23-2010 04:34 PM
Hi again,
I have been trying to reduce the size of my program by combining 5 digital outputs using one create task. The problem I am facing is with respect to sending the right boolean array to the right line.
Please find attached diagram to help me choose the right one. I have combined 5 digital lines, so I would need 5 rows and update each row as program loops. It doesnt seem to work. I use 6008 DAQ.
Also, is it right to refer a digital line as a "channel" or does create a single task create one channel?
11-24-2010 01:42 PM
Hi VeeJay,
You would use the 1D Boolean (1 line per channel) option. With this, you can write your array of values [ T F T F T ] for example, in a 1D array, and then write it so line 0 will get index 0 of your 1D array and line 4 will get index 4 of the array. You can have that array change per loop iteration.
To define terminology, I will tell you the parts of a DAQmx Digital Output task with one channel containing 5 lines on your port:
Task = Digital Output
Channel = Grouping of Digital Lines
Lines = Actual DO lines, such as Port 0 Line 0
So by creating one channel for each line, you can output a single value per channel, and the corresponding line will receive that value. Having multiple lines per channel will cause you to have to write a 1D array of booleans for each channel, plus multiple channels or groupings. Maybe a better way to explain this is with an example. I have 5 DO lines in one channel, to write to that would take this:
[ T F T F T ]
If I have two channels, 3 lines per channel, the array to write to those lines would be a 2D array that looks like this:
[ T F T ]
[ F T F ]
For your particular case, you want the first array, where each value corresponds to a line in your task, so that would be once again DAQmx Write Digital 1D Bool NChan 1Samp.vi.
11-24-2010 02:04 PM
Thank You Kyle! It makes total sense. I actually figured it out before I got your message, but your explaination is stupendous. One more question on the lines of multiple lines on one channel. But, in this case, it is analog input. Here is what I don't understand whether it is my programming or problem with DAQ.
I am reading three analog inputs differential and have created one analog input task. Now, for eg. line 3 in the channel reads 1.2V when we split the array of values. To verify if that is the correct voltage, I created an analog task on MAX just for line 3 and saw that the voltage was much higher around 1.6V. Why is there a difference between grouping analog lines vs reading from single lines.
Thansk!
Jay
11-24-2010 03:15 PM
Hi Jay,
Differential measurements is the difference between two channels, so for your 3rd channel, you are actually measuring across two channels (like ai2 to ai10). Analog channels are typically not referenced as 'lines' per say, that is more digital terminology. So when you get a result back for the 3rd analog differential channel, it is something like ai2 - ai10 = result.
When you create a task just for the channel, are you making it RSE or NRSE? If it is RSE, you are taking a measurement in respect to AI GND on the board. If it is NRSE, you are taking a measurement in respect to AI SENSE. You can reference this guide for more information about signal connections.
There could be a 0.4V mismatch between your low side and GND, or you may have left a channel floating. Review the user manual to your hardware for more information on connecting differential analog inputs and RSE analog inputs.