I am a beginner in the Labview. I did a serial communication program ,firstly write a command than start data acquision,During running VI, the data is continuously obtained.But When I want to stop the startDAQ button ,this button doesn't work ,it cann't be pressed in front panel.
One more thing，Why I use event structure ？because I have some commands，so these buttons（event structure） respond immediately. If I don't use this structure, is there any other way?
Can anybody help me, please?
Solved! Go to Solution.
read the help for the Event structure. And read the caveats section of the help!
1. Don't hide the event structure inside a case: the event structure should be able to react on events at all the time.
2. By default the UI is blocked until an event is handled. You start your event using the "startDAQ" button so you cannot use this (or any other button) to stop this event case…
Suggestions: Think about restructuring your application. Think about proper statemachine. Think about queued message handlers.
You definitely should be looking at using a Queued Message Handler for your serial port communications. This way, the reading can happen in parallel to your main loop. You just use a queue to send a message to the QMH to send a message, close, setup, etc.
Also, DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The Bytes At Port causes all kinds of weird race conditions with your instrument. Use your instrument's protocol. Do you know what the protocol of your instrument is (ie, how the data message is formatted)? Binary communications typically either use fixed sized messages (all messages are the same length) or the length of the message is embedded into the header of the message. Use this information instead of relying on the Bytes At Port.
Thank you for your reply .I want to use the queued message handlers.method, but there are too few serial communication data projects in this way.
Is there any relevant information to learn? Thanks!
Here is a quick example I just put together. Far from complete, but a good place to start.