From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect boolean case structure to multiple channel digital output?

allen716_0-1651833170735.png

 

 

allen716_2-1651833565565.png

Hello,

I can connect the case structure to a single channel of digital output. Then I want to control two digital output channels at the same time, I connected the case structure to multiple channels, but it told me I connected two different types.

My question is: How can I connect the case structure to multiple channels?

Thanks a lot.

 

allen716_1-1651833207467.png

 

0 Kudos
Message 1 of 4
(748 Views)

(It is difficult to debug pictures. we prefer to see the actual VI.)

 

Obviously, unders some settings, your IO wants an array of booleans, but your case structure outputs a scalar. Round peg, square hole!

 

You need to decide what you want and create the appropriate output. we don't know what that would be based on a single comparison. Also be aware that your code seems dangerous. Wiring a DBL to a case structure rounds to the nearest integer, so if your signal is betweeen about -0.5 to 0.5, it is considered zero. What's in the other case(s)? Why is there a sequence structure? Why are the wires such a mess?

0 Kudos
Message 2 of 4
(723 Views)

allen716_0-1652005368722.png

Dear Sir,

Please check the attached file.

I want to control line0:2 by the case structure at the same time. How to solve this problem?

Thanks a lot.

0 Kudos
Message 3 of 4
(699 Views)

Instead of asking how to connect incompatible datatypes, take a step back and tell us what the program is supposed to do:

 

  • What are typical default values for all controls (e.g. LED on and LED off numerics)? All controls should have typical default values.
  • Under what conditions should the VI stop (Wiring a continue if true to a comparison does not make it obvious)
  • You are reading a single DBL and creating a boolean out of it. I doubt you need a case structure and two comparisons for that.
  • If you have three LEDs and they should all go on/off at the same time, just take your boolean and make it into a boolean array with 3 elements. Do you know how to do that?
  • Again, why don't you leave the hardware out of it and do a simulation instead (e.g. using a slider for the reading and a few booleans (or a boolean array) as output. Test it until everything works as expected.
  • Your loop has no obvious timing. What would you think is a typical loop time?
0 Kudos
Message 4 of 4
(693 Views)