Pages: [1]   Go Down
Author Topic: Serial Buffer, Background, Affects timing?  (Read 273 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all!

I am working on a project that is recording from a GPS, a serially outputting device, and an I2C device.  I am trying to make sure that before I get too deep into this, I don't have timing issues.

I have an Arduino Mega, so I have the multiple hardware serial ports. 

Question 1:
Can I have multiple devices continuously talking continuously without missing data?

Question 2:
Now, what I am having trouble understanding is: Does the data coming in from any serial device get held in the respective buffer in the background until I handle it, or do I need to make sure I know how many bytes are coming in, do that math and make sure that everything has enough time to do what it needs?

For instance, 39 bytes coming in = about 40 milliseconds.  If I want to catch the next GPS output (1 Hz), I have 960 milliseconds to do whatever else I need to do.  Or, is it 39 bytes come in the background, Arduino keeps doing whatever it is doing, If the GPS sends something it'll grab that too.  Every so often I can check in, grab everything, parse it, and log it.

Thanks to any help anyone can provide.  Maybe I'm missing something basic.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8589
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Can I have multiple devices continuously talking continuously without missing data?
Yes.

Quote
Does the data coming in from any serial device get held in the respective buffer in the background until I handle it,
Yes, up to 64 bytes, after that you will lose data.

Quote
Every so often I can check in, grab everything, parse it, and log it.
Yes, as long as you process the data at an average rate >= the rate it's coming in.


_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Rob,

Thank you very much for the response!  Not only does that answer my question, but now I know how many bytes I can let sit in my buffer into I need to process them.

Thank you!
Logged

Pages: [1]   Go Up
Jump to: