LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

comparing digital input and output from two different DAQs

I want to create this program where the digital output lights up LEDs at random and push buttons are the digital input part of another DAQ are pushed. When the correct button is pushed, the score will increase by 1. My code doesn't work though. Can someone point my errors to me? Both the DAQs i'm using are USB-6008 DAQs. thanks
0 Kudos
Message 1 of 58
(3,665 Views)

Hi Flibberty...,

you can use the "equal?" function to compare your arrays. Both arrays should have the same length, otherwise the result array has the length of the smallest.

 

Mike

0 Kudos
Message 2 of 58
(3,652 Views)

Hi Mike,

 I used the 'equal' function in the event structure but it isn't working.. and could u elaborate more on array size please? I'm utilizing ports P0.0 - P0.7 on both DAQs. thanks 

0 Kudos
Message 3 of 58
(3,648 Views)

Let's start with the digital output 🙂

What is this code all about?

 

Do you want only one of the 8 led's to lit randomly or are multiple led's also ok?

The two possible codes are in attached file SNAG-003.jpg

Connect the output of the "Scale by power of 2" function or the "Multiply" output directly to the Write DAQmx vi

 

I don't understand the purpose of the "Boolean Value" and "Replace subset array" thing, so I skipped it 🙂

 

Download All
0 Kudos
Message 4 of 58
(3,647 Views)

I'm utilizing ports P0.0 - P0.7 on both DAQs.

 

No you don't 🙂

The DAQmx read is a 32 bit, not 8 🙂

0 Kudos
Message 5 of 58
(3,646 Views)

Hi Alain,

 

I want only 1 LED to light up at each time.. and how do I compare a 32 bit input/output? thanks 

0 Kudos
Message 6 of 58
(3,640 Views)

Only 1 led, so you should use the "Scale by power of 2" function.

You should also wire something to the 'Timeout" terminal of the event structure.

Maybe 300 and skip the "Wait until next ms Multiple" function.

Now the Time out event will never be run since the default is -1 meaning no time out.

 

Compare 32 bit? Just like any other compare with the "Equal?" function.

 

But I don't get the purpose of your code Smiley Sad

The code lit one led ok but then what is supposed to happen?

A user hits the corresponding button or what?

 

What is the purpose the the "Boolean value" control?

0 Kudos
Message 7 of 58
(3,628 Views)
Is this code what you had in mind?
Message 8 of 58
(3,626 Views)
Thanks Alain. That was exactly what I had in mind. I edited the VI to fit into my VI but apparently the button's write function seems to read a little slow.. Is there any way I can change that? 
0 Kudos
Message 9 of 58
(3,609 Views)
I forgot to attach my VI. Here it is.
0 Kudos
Message 10 of 58
(3,607 Views)