LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daq assistant as a case selector

Solved!
Go to solution

Hello,

 

I'm trying to read a digital input from my daq assistant, and then to hold it for a x number of seconds, until the time is elapsed. The input of the assistant should not matter after the first input.

So i used a case selector and started trying with a virtual switch. All worked fine... until i'd start trying with the daq assistant. The output from a daq assistant is a 1 d array of boolean. The input for the case selector is a boolean.

 

Is it possible to select the case depending on the output of the daq assistant? If true, how can i do this?

 

Greetz Nilvo

0 Kudos
Message 1 of 19
(3,386 Views)

Are you only reading one DAQ input channel? Are you using a state machine?

Tim
GHSP
0 Kudos
Message 2 of 19
(3,382 Views)

Yes it's only one chanel to read.

What do you mean by state machine?

I'm using the NI USB-6008

 

Gr

0 Kudos
Message 3 of 19
(3,379 Views)

Do you have any code written?

Tim
GHSP
0 Kudos
Message 4 of 19
(3,370 Views)

Yes, in the attachment you can find my code.

If you replace the local var by a switch, the program works fine.

 

Gr

0 Kudos
Message 5 of 19
(3,365 Views)

By the local var I mean the var "Capacitief Input" next to case selector

 

offtopic, how do you edit a post?

0 Kudos
Message 6 of 19
(3,363 Views)

Your local variable is for a 1-D array of booleans.  You can't wire that up to a case selector since it needs a single boolean.  You would need to use Index Array to get the value of a particular boolean out of that array.

 

You can edit a post by going to the options menu to the upper right of your post.  But you have a time limit of 10 minutes after you first post it to be able to edit it and repost the edited message.

0 Kudos
Message 7 of 19
(3,359 Views)
Solution
Accepted by Nilvo

I added an index array to your code that changes the array to a single number. Keep in mind that this give you only the first digital input. If you change to a different channel you will have to index that array to a different number.

 

Second the elapsed time is not a very good way to measure time so I changes the way the vi was measuring time.

 

Third the oustside while loop is not necessary. The two loops will run until you push the stop button. I would think about using an event to capture the stop function so that you only need one stop button.

Tim
GHSP
0 Kudos
Message 8 of 19
(3,357 Views)

OK here is the second version with the event structure.

Tim
GHSP
0 Kudos
Message 9 of 19
(3,353 Views)

Don't forget to make the hold time 6 seconds on the front panel.

Tim
GHSP
0 Kudos
Message 10 of 19
(3,352 Views)