Go Down

Topic: Combining Serial prints ... HELP! (Read 1 time) previous topic - next topic

Tom Carpenter

#15
Oct 09, 2012, 10:49 pm Last Edit: Oct 09, 2012, 10:54 pm by Tom Carpenter Reason: 1
Just for the sake of interest, the method using multiple print() calls is faster than the sprintf() method (in one simple test).

For a loop of 100 calls to printing the data for each, the results are:
multiple print()'s : 210556 us
sprintf() : 210972 us

That is at 115200 baud and the same group of calls as in that snippet of code you posted.

For a loop of 10000 calls to printing the data for each, the results are:
multiple print()'s : 23378412 us
sprintf() : 22798020 us

Interesting, sprintf() seems to have recovered. I think the first test may have been biased as for the first few iterations sprintf() had more to print as micros() had a larger value (more decimal digits)

But yeah as has been pointed out:
115,200 baud = 11520 bytes per second = 11.52 bytes per millisecond, not including the time it takes to get the data and load it into the buffer etc.
~Tom~

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy