LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial character event

Hi,
 
I want to ask a question that has been asked on this forum many times before, but there's no clear answer to it.
I am using serial port communication to talk with a microcontroller. As soon I open the serial port I want to enable the serial character event. The incoming data is indefinte in terms of when it will arrive and how long the data will be. Thus, this event should quitely be listening to the port all the times and read data whenever bytes at serial port are greater than 0. (Something very similar to On_Comm event in C#)
In parallel to listening the port, I want to be able to fire other events like button click which may result in sending data through serial port and updating messages on UI.
I went through the documentation and found detect break event example. I implemented something similar. I call this VI after I successfully connect to the micrcontroller through the serial port. But it locks my UI and all I am doing in the program is listening to the serial port.
Any suggestions?
 
Thanks.
0 Kudos
Message 1 of 4
(2,682 Views)
I am confused as to what you mean by it "locks your UI".  You don't have anything else going on in your attached code like you describe in your message.  The only "UI" thing going on is the reading of the stop button.  The wait on Events has a 5000 msec timeout.  So if you click your stop button, during a loop iteration, that wait on event has to timeout (up to 5 seconds.)  The loop will start again and the stop button will get read, but the loop won't end until another 5 seconds has passed while the Wait on events times out again.
0 Kudos
Message 2 of 4
(2,653 Views)

Hi,

I attached only the UI that takes care of data event. It is being called by the main UI which I didnt attach. The moment I call this sub VI, my main UI VI will stop responding to other events.

Thanks.

0 Kudos
Message 3 of 4
(2,622 Views)

You may want to rethink your architecture, provide some more details on what the main VI looks like.  Because of dataflow, the main program won't continue past the subVI until the sub VI provides its outputs.  There are ways around this using some VI server calls, but I can't help with this much because I am just beginning to figure those out myself.

But basically, if you have code that is dependent on the output of a subVI, it won't execute until the subVI is complete.  Code running in parallel loops that is not dependent on the subVI will still run.

0 Kudos
Message 4 of 4
(2,605 Views)