LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in reading data from serial port continuously- application hangs after sometimes

I also found one thing very interesting, I dont know wheter its a bug or feature Smiley Very HappySmiley Very HappySmiley Very Happy

 

My app doest hang, what happens is my while loop stops and iteration value doesnt increments, if I keep weight then also it will not show in my PC. when I scan my serial number then my kept weight appears along with my serial number appears together and my iteration indicator will start increment.  

 

On my first try it indiator increment stops at 95 and in my second try it stops at 712.

 

 

 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 41 of 60
(931 Views)

Is it becasue I am reading both the COM in same while loop thats why its happening and when hangs then it resumes only when I scan serial number (this serial number will not appear from com port instead using scanner as serial interface )

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 42 of 60
(928 Views)

I would use two loops, one for each serial device so they can each read as fast as they need two.  Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues.  I'd use a notifier, or just use local variables.  One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop.  There you have the logic that determines when you nave "new" updated values that is time to log to the file.

0 Kudos
Message 43 of 60
(900 Views)

@RavensFan wrote:

I would use two loops, one for each serial device so they can each read as fast as they need two.  Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues.  I'd use a notifier, or just use local variables.  One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop.  There you have the logic that determines when you nave "new" updated values that is time to log to the file.


Ahh, I was under the impression that he needed every single datapoint.  If I thought about it, you would end up with huge amounts of data in no time.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 44 of 60
(891 Views)

@RavensFan wrote:

I would use two loops, one for each serial device so they can each read as fast as they need two.  Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues.  I'd use a notifier, or just use local variables.  One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop.  There you have the logic that determines when you nave "new" updated values that is time to log to the file.


I need a teaching moment from you.

 

If you used notifiers or local variables, how could you guarantee data sync?  Both are lossy and I'm not sure how you could guarantee how you could lose the same amount of data from each if they only look at the latest data?

 

I hope you understand what I'm trying to get at - it's not easy for me to explain.

 

Thanks!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 45 of 60
(888 Views)

@billko wrote:

@RavensFan wrote:

I would use two loops, one for each serial device so they can each read as fast as they need two.  Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues.  I'd use a notifier, or just use local variables.  One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop.  There you have the logic that determines when you nave "new" updated values that is time to log to the file.


I need a teaching moment from you.

 

If you used notifiers or local variables, how could you guarantee data sync?  Both are lossy and I'm not sure how you could guarantee how you could lose the same amount of data from each if they only look at the latest data?

 

I hope you understand what I'm trying to get at - it's not easy for me to explain.

 

Thanks!


The idea is that when you recieve data from both you will have the latest data for each.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 46 of 60
(886 Views)

@crossrulz wrote:

@billko wrote:

@RavensFan wrote:

I would use two loops, one for each serial device so they can each read as fast as they need two.  Since it sounds like you only need the mpst recent value from either device, I wouldn't use queues.  I'd use a notifier, or just use local variables.  One writer to the indicator in each serial loop, 2 local variables (one for each device) to read the values in the processing loop.  There you have the logic that determines when you nave "new" updated values that is time to log to the file.


I need a teaching moment from you.

 

If you used notifiers or local variables, how could you guarantee data sync?  Both are lossy and I'm not sure how you could guarantee how you could lose the same amount of data from each if they only look at the latest data?

 

I hope you understand what I'm trying to get at - it's not easy for me to explain.

 

Thanks!


The idea is that when you recieve data from both you will have the latest data for each.


Hey, thanks for replying.  I can now refine my question.  What happens if the loops are running at different speeds, like let's say one is running twice as fast?

 

Thanks for taking the time out to help me understand.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 47 of 60
(883 Views)

Bill,

 

If the loops' speeds differ by that much (>= 2:1), then the question really becomes "What is the relationship of the data from the two sources?"  I have the impression that the OP in this thread does not have that problem.

 

If the speeds differ significantly, I would do something a little more complicated, such as using a waveform datatype where the t0 value specifies the age of the data or include a timestamp in a cluster with the serial port data.

 

There can be no universal solution for truly asynchronous data sources because there are infinitely many possible combinations. You need to have some knowledge of the behavior of the sources and the requirements for the system.

 

Lynn

0 Kudos
Message 48 of 60
(873 Views)

@johnsold wrote:

Bill,

 

If the loops' speeds differ by that much (>= 2:1), then the question really becomes "What is the relationship of the data from the two sources?"  I have the impression that the OP in this thread does not have that problem.

 

If the speeds differ significantly, I would do something a little more complicated, such as using a waveform datatype where the t0 value specifies the age of the data or include a timestamp in a cluster with the serial port data.

 

There can be no universal solution for truly asynchronous data sources because there are infinitely many possible combinations. You need to have some knowledge of the behavior of the sources and the requirements for the system.

 

Lynn


Thanks - that expained everything.  🙂

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 49 of 60
(870 Views)

Thanks for the discussion friends but its too late but never too late.

 

This while loop iteration increment is not halting in development PC but happening in other PC where I am installing my application

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 50 of 60
(857 Views)