I am getting error 200524. It says number of channels does not match number of channel in the task. But i have provided equal number of channels as number of task. Can anyone suggest what should I do to remove the error? And also i am getting an error while wiring when I am trying to write continuous signal from daq assistance in case 1. Can anyone suggest this also?
Solved! Go to Solution.
Currently, you're providing a 5x7 array. When the For loop auto indexes the array, you are left with just a 5x1 array (auto indexing goes by rows, not columns). As a result, the DAQ Assistant receives an array with 5 elements, not seven. Try using a 7x5 array instead.
I am trying to make the logic which i have attached. When i use the solution you recommended it does not work the same as wish to do. It changes the port selectons. Is there any other way so that I can keep the logic and avoid this error.
If I read that chart correctly, you have a pattern that you want to output across 5 channels. However, you have more than five channels in the DAQ Assistant. The error would indicate that there are 7 channels in the DAQ assistant and the VI you posted has 6 channels. You'll either need to reduce the number of channels in the DAQ assistant to 5 or add another column to your data for the information for the other channels.
Thanks for replying
The pics above are of case 5 . There are 7 cases in total. In case 5 the array which I created for that is 7X5. The error is also of case5. But when you might have opened the vi, the vi opened with case1 and other cases are there. In case 1 there is an array of 6X5. In the DAQ placed in case1 i have provided 6 lines. In all the cases I am getting the same error but i posted the pic of case 5.
Actually in the chart logic is given for how to operate 32 ports. I am using state machine and divided them in 7 different cases and in daq assistance box i gave each port 1 channel so that if i need to write the data in spreadsheet it will be easier for me.
Looking through the VI, in each of the first five cases, you're providing an array of 5 values to a DAQ Assistant with either 6 or 7 channels. This is why you are seeing the error. Your 5x32 array is becoming a 5x1 array when it enters the For loop.
Are you trying to use the number of iterations of the For loop to control the data that goes to each channel? Because what is happening right now is that, for Case 1:
For loop iteration one:Row 0 of the array is passed to the DAQ assistant which means:
r0, c0 (F) for DigitalOut
r0, c1 (F) for DigitalOut_0
r0, c2 (F) for DigitalOut_1
r0, c3 (F) for DigitalOut_2
r0, c4 (T) for DigitalOut_3
And nothing for channel DigitalOut_4
For loop iteration two:Row 1 of the array is passed to the DAQ assistant which means:
r1, c0 (F) for DigitalOut
r1, c1 (F) for DigitalOut_0
r1, c2 (F) for DigitalOut_1
r1, c3 (T) for DigitalOut_2
r1, c4 (F) for DigitalOut_3
And nothing for channel DigitalOut_4
You'll need to rewrite how you are doing your array and your loop to make sure that there is a digital value for each line. How do you want the 5x32 array divided among the channels for case 1?
I am using a multimode switch and try to take reading. The switch has 7 pins. In one pin i need to give 5v and in one to ground. rest 5 pins require 0,5V TTL signal to control 32 ports in the switch. I was thinking if i need to use 6 ports or 5 ports or if all 32 so i divided in different cases. If i use only 5 ports i don't want to run rest of the ports without any reason. I added for loop so that if i want to run test 3 time or 7 time after an hour it does automatically. In case 1 i can also have only 5 ie i can divide 5 in each cases.
Can you suggest me what will be the better way to do it. Or what modifications can be done in this vi?
So, I may be able to clarify a few things. From the DAQmx perspective, a "port" is just a grouping of lines. On the USB-6216, there are two "ports" each with 16 lines. You can control the digital output either as a "port" (one channel with 16 lines) or as 16 lines (16 channels with one line each).
Do you need to connect to just the 7 control pins or also to the 32 ports on the switch?
If you just need to control the 7 control pins, I would recommend the following:
Connect the ground of the switch to the ground of the USB-6216.
Connect the +5V pin of the switch to the +5V pin of the USB-6216 (pin 10 or 42).
Connect each of the 5 digital control pins to a digital line on the USB-6216. Thus, your DAQ assistant will only have 5 channels.
Do you want to output all 32 digital commands on each pin? For instance, during one test do you want each line to update 32 times? If so, what kind of timing do you need?
I just need to control 7 pins, but in order to perform test i need to use two switches which means 14 ports in total. I am going to provid voltage and ground from daq since daq provide enough current to operate switch. It depends on test sometime we need 5 lines or some time all 32. and usually it runs for a week and in a day we acquire reading every hour which means in total 84 times.It depends on cable to cable that we need to test.
So, based on the table in the data sheet, each column will corrospond to a digital line on the USB-6216. You will then either output the pattern along that row to select that port on the network switch.
So, let's assume you are controlling two switches. As a result, let's connect lines 0-4 to the first switch and lines 5-9 to the second switch. That would mean there are 10 digital channels in your DAQ assistant (the +5V and ground lines don't have channels in your DAQ assistant).
Thus, to connect both of the switches to port 0 on the switches, the array that you would pass to the DAQ Assistant would look like this:
Now, in order to connect port 0 of both switches then port 1 of both switches, we can use a For loop and a 2D array, along with the autoindexing function of the For loop.
The array looks like this:
And the code looks like this:
From here, you can add rows to the array based on the number of ports you plan to use. You can put all of this code in a loop to run it repeatedly
To pick between 5 ports and 32 ports, just change the array you pass in. The array should be 10x5 for 5 ports and 10x32 for 32 ports.
I hope this get's you started on the right path,