01-05-2015 09:46 AM
Hi Everyone. I'm working on a motion control system for a flight simulator base using Labview. My code uses a while loop with a few case structures to constantly transmit data to a second computer where it is conditioned into base motion data. Currently, these transmissions occur in real-time: I cannot input three different commands and execute them at once.
I want to be able to input multiple different values into a seperate controller and "start" them all together. An event structure seems like it would be the perfect solution to my problem, but I'm having difficulty with the program timing out or receiving the wrong inputs, which causes some diasterous effects on the machine. Any help on where I should place this event structure, how to wire the inputs to existing controls, or any helpful tips are greatly appreciated.
01-05-2015 09:15 PM - edited 01-05-2015 09:22 PM
1. Your event structure must be inside a while loop to trigger on more than just a single event. http://zone.ni.com/reference/en-XX/help/371361H-01/glang/event_structure/
In your VI the event structure will only ever fire once when you click "Start 2". Then it will never fire again.
2. Every control that you want an event to fire on must be registered and handled in an event case. They can all be in the same case, as long as they are registered in there somewhere.
3. Try to keep your block diagram on a single screen, it makes it easier to follow. (Unless your screen is actually twice as high and wide as mine?)
4. Try to keep all wires visible and all data flow from left to right, wires shouldn't be going backwards or behind objects etc. That will also make it easier to follow.
5. You are already using basic state machines, you probably don't need to have a while loop in a while loop.
6. If you need different actions performed asynchronously you will likely need more than one while loop (executing asynchronously, not nested) using queues to communicate between them.
7. Do you really need to continuously transmit data or only on change?
There's more but that should give you a good start.