LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Array Scanning

Solved!
Go to solution

Thank you for your response.

I have implemented your suggestions and am working on implementing the column choosing.

Thank you.

CLD Certified 2014
0 Kudos
Message 11 of 20
(1,343 Views)

I am not sure what is a better option:
1. Making this a subvi, one for rows and one for columns

2. Implementing columns into this current vi.

 

I am not sure where I would put the columns chooser code. Do I add another while loop that starts after the row has been chosen?

I am not sure what would be most efficient.

CLD Certified 2014
0 Kudos
Message 12 of 20
(1,328 Views)

There has to be a better way than this...

Any ideas?

There is only suposed to be one button.

CLD Certified 2014
0 Kudos
Message 13 of 20
(1,317 Views)
Solution
Accepted by topic author ADrexelDragon

There's definitely a better way. Remember you simply want to toggle between rows and columns. Thus, you really only need the original two loops. In the upper loop you just need to know whether you're dealing with rows or columns. A simple Boolean flag carried around in a shift register (or a Feedback Node if you prefer) can be used so you know whether you're dealing with rows or column. The bottom loop just needs to generate the "event" that you pressed the hardware button.

 

Why are you casing out the stuff in the upper loop if you see a 2? The loop will stop anyway. If you are seeing a delay in response to stopping the loop it's because you have a 1.5 second delay in moving the true. What you really want to do is to have a short delay and to compare the current time against a "last check time". If 1.5 seconds has elapsed, then update your indicator. This will make the top loop respond much more quickly. You can use the Elapsed Time Express VI for this.

Message 14 of 20
(1,309 Views)

How about this?

CLD Certified 2014
0 Kudos
Message 15 of 20
(1,305 Views)

Much better and easier, right? A couple of minor nitpicks:

  • It's redundant to compare a Boolean to True. In your lower loop just wire the Boolean control directly to the case structure.
  • If you change the Boolean's mechanical action to latching then you don't need to reset it inside the case structure.
0 Kudos
Message 16 of 20
(1,295 Views)

Thank you.

How would I make this a Subvi for a larger program?

CLD Certified 2014
0 Kudos
Message 17 of 20
(1,292 Views)

@ADrexelDragon wrote:

Thank you.

How would I make this a Subvi for a larger program?



You need to set up the connector pane by wiring the controls and indicators to it. In the caller VI you connect to the terminals just like any the LabVIEW functions.

=====================
LabVIEW 2012


0 Kudos
Message 18 of 20
(1,276 Views)

Thank you.

I understand how to do that. I just don't see how the LEDs would light up in the main program. They are continuiously being updated within the subvi.

CLD Certified 2014
0 Kudos
Message 19 of 20
(1,274 Views)

If you want the LEDs in the main VI then you need to pass in a control reference to the subVI so that it operates on those controls, rather than the controls on its front panel. There's examples on using control references that ship with LabVIEW.

Message 20 of 20
(1,256 Views)