06-02-2011 07:24 AM
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
Solved! Go to Solution.
06-02-2011 07:59 AM
Are you only reading one DAQ input channel? Are you using a state machine?
06-02-2011 08:33 AM
Yes it's only one chanel to read.
What do you mean by state machine?
I'm using the NI USB-6008
Gr
06-02-2011 08:53 AM
Do you have any code written?
06-02-2011 09:04 AM
Yes, in the attachment you can find my code.
If you replace the local var by a switch, the program works fine.
Gr
06-02-2011 09:09 AM
By the local var I mean the var "Capacitief Input" next to case selector
offtopic, how do you edit a post?
06-02-2011 09:18 AM
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.
06-02-2011 09:18 AM
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.
06-02-2011 09:23 AM
OK here is the second version with the event structure.
06-02-2011 09:26 AM
Don't forget to make the hold time 6 seconds on the front panel.