LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write cannot be performed, because the number of channels in the data does not match the number of channels in the task.

Solved!
Go to solution

My VI is working as a motion sensor.  Each time the motion sensor is activated, the LED comes on, and a beep sounds (a switch is acting as my motion sensor).  Once all the LEDs are activated, the system reset is supposed to light up, and then the other three LEDs turn back off waiting to be activiated once again.  On my attachment saved as "sensor project," I have the VI working with the DAQ by implementing a random number case, and the VI works here to give a demonstration of the outcome I am trying to work towards. Any information would be greatly appreciated.

0 Kudos
Message 1 of 5
(3,445 Views)
Solution
Accepted by topic author saints26

You have some logic and dataflow issues.

 

Once all three sensor loops stop, all the outputs are necessarily true, so the compound node and case structure in the following (reset) loop is unecessary. Because the termination boolean in the fourth loop is immediately true, the loop will stop and not care about the state of the reset button. Maybe you should wire the termination condition to the wire going to the system reset indicator instead. Since this is also a polling loop, it needs a small wait. Once reset is pressed, the VI completes and stops. (Don't use the continuous run mode!).

 

Solution: Create a state machine with one single outer loop. You have 4x too much code!

0 Kudos
Message 3 of 5
(3,431 Views)

Thanks for your help.  Before I read your post I was able to get everything working.  I found that the DAQ in the true portion of the case structure was unnecessary so I deleted it, while leaving it on the false side.  I have attached the working version of it below.  Thanks again

0 Kudos
Message 4 of 5
(3,427 Views)
  • You still have way too much boolean logic. Most of it is redundant.
  • Why are the string indicator inside cluster containers? Just to complicate the code?
  • Code that is shared among all cases of a case structure belongs outside the case. For example for the DIO writes, the express VI belongs after the case and only the boolean array belongs inside.
  • The termination conditions only seem to depend in the DI read, so you can wire it right there. No need for diagram constants inside the cases.
  • As I said, you need to look into state machine architectures. All you need is a single outer loop.
  • ...
0 Kudos
Message 5 of 5
(3,419 Views)