LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

comparing digital input and output from two different DAQs

Oh, and another question. How do I link nodes from one event to the other?? 
0 Kudos
Message 21 of 58
(1,232 Views)
 

The Idle state is for the moment that the computer has nothing to do Smiley Very Happy

When all processing is done and you have no specific task to do, you send your state machine to the Idle state. In the Idle state the PC is waiting for something to happen, user click a button, did something with the mouse, a specific time is triggered, ... ...

That structure will have a case for each user button and the default Time out case, I would suggest a 10ms time out time wired to that event structure. That means that the code in the Time-out case is executed every 10ms.

In that Time out case you check the player-level-time-out, the playing time (1 minute I think), jump to the "Read Digital Input" case, ... ...

 

You can pass data between states in two ways.

First way, make a hugh cluster that contain all this data. That cluster is then available for all states using a shift register. Use "Bundle by name" & "Unbundle by name" to retrieve the data needed in each state.

 

Second way, use separate controls to hold the data. Then use property nodes to read/write to those controls.

 

I never had more than 3 shift registers. One for the error cluster, one for the array with states and one for the cluster with all the common data. If you use separate controls to pass data, you will have only two shift registers.

0 Kudos
Message 22 of 58
(1,223 Views)
so for example, if i have 8 buttons, i'm supposed to have 8 cases for all the buttons? I'm having trouble doing my VI now Smiley Sad
0 Kudos
Message 23 of 58
(1,217 Views)

I see your confusion now Smiley Surprised

The cases in the even t structure are for buttons, switches, numerical inducators on the front panel, not for buttons, switches attached to digital I/O cards!

 

0 Kudos
Message 24 of 58
(1,215 Views)
yup! thats where I'm confused.. and I do not know how to create property nodes for the program.. could you give me a head start please? thanks
0 Kudos
Message 25 of 58
(1,212 Views)

Then use a big cluster with all data that you need to pass between states and a shift register Smiley Happy

 

or use this

 

In the block diagram right click the control you want a Property Node of.

Then select Create\Property Node\Value

By default you get a Read

 

Change it write?

Right click the Property Node

Then select Change To Write

Now you can wire something to the Property Node

0 Kudos
Message 26 of 58
(1,211 Views)
I've editted my program but I'm still having problems with it. Can someone help me please? I'm really desperate now
0 Kudos
Message 27 of 58
(1,192 Views)

Don't panick 🙂

Attached a modified running version of your code.

But it's not a final version.

I had to remove all the LCD stuff since I don't have those vi's
Since I don't have the necessary hardware I can't really check the read DAQmx stuff 😞

 

It's not clear to me what you entend to do with the start timer stuff, can you explain?

 

Now the program is running for 30 seconds and then quit with a message.

Try to understand the rest and if something is unclear ask 🙂

I hope you also will understand the state machine stuff with the array with this running version.

 

Next time please post all those LCD vi's in a zip file so that I don't need to delete that state again.

Download All
0 Kudos
Message 28 of 58
(1,183 Views)

Alain, thanks again. You've been a big help. however, I can't seem to run the VI. The problem seems to lie in the Write to LEDs state, with the error Case structure: selector values are not unique. 

 

The start timer is meant for the duration of the game, which in my case is 60secs(1 minute). The 7-segment display is supposed to show the remaining time of the game.  

 

I've attached the VIs of the LCD as well, but I have no idea where to include them in. 

0 Kudos
Message 29 of 58
(1,174 Views)

We are getting there one step at the time 🙂

What are the LCD VI's for?

 

You should use both attachments, the vi istself and the type def with the different state names to avoid the error "Selector values are not unique"

 

So your start timer was more like a stop game Smiley Tongue

I start the game by starting the vi, is that a problem?

The stop button is a stop now, quit state.

If yoy want to start the game, then add a button and try to integrate it in the state machine.

 

Download All
0 Kudos
Message 30 of 58
(1,167 Views)