LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

execution highlight problem

Solved!
Go to solution

I have a problem about highlight execution, I guess the problem is about the timing conditions but I have no solution for this.. I will explain the code shortly: 

this program reads data from RS232 port and acceps an array then decompose it small strings, also it provides writing to RS232 port. 

the problem is that I cannot run the program without highlight execution, it gives nothing without this mode..here is my vi

 

"You live in a graphical world. Why not program in one?"
0 Kudos
Message 1 of 3
(2,065 Views)

A few problems.

 

You are opening and closing the com port on every iteration of the while loop.  Don't do that.  The port should be configured before the loop, closed after the loop, and only the reading done in the loop.

 

Problem two.  You are flushing the port on every iteration of the while loop.  You should almost never need to flush the serial port.

 

What happens when you run full speed is that you open the port, flush anything that comes in, then read bytes at port.  That is almost always going to be zero because you just opened the port, and then go and flush it even if something snuck into the port.  It works somewhat in highlight execution because you slowed down the execution enough that there is a little bit of time for bytes to arrive at the port between flushing and checking the bytes at port.

 

The bytes at port I find is usually the wrong way to go in most serial port applications.  If you have any idea of the protocol of the data coming in?  I see you have the termination character disabled.  With a clear idea on the format of the data, we might be able to suggest the best method for reading and decoding the data.

Message 2 of 3
(2,063 Views)
Solution
Accepted by VeliBayar

thanks a lot!  now program works properly 🙂

"You live in a graphical world. Why not program in one?"
0 Kudos
Message 3 of 3
(2,048 Views)