Hi Coding!
I need to keep it in multiples of the clock frequency... that's good to know, thanks!
I've just run some benchmarks to see what happens if numbers greater than 115,200 are used.
There IS an increase in throughput. ![]()
But it's only 4.75Kb/s. =(
Something is creating that ceiling - do you think it's the ATTiny that acts as the USB to Serial interface?
/*
Arduino code
This is a simple Arduino program that outputs a byte to the Serial port as fast as it can, the byte cycles from 0 to 255, and back around.
Looking at the following benchmark, we can see that we can throughput 19,200 bytes a second.
That is faster than the "Serial Monitor" in the Arduino IDE can support.
It's a total of 18.75 Kb/s, just by using the standard Serial output on the Arduino, and standard Serial input on Processing.
That's a bit better than the 115,200 baud (14 Kb/s) the Serial Monitor supports.
But a long way from the 122Kb/s 1 Megabaud would provide. (6 times slower in fact!)
Baud rate = Bytes received per second
50,000 = 5,080
100,000 = 10,100
150,000 = 15,600
200,000 = 19,200
250,000 = 19,200
300,000 = 19,200
350,000 = 19,200
400,000 = 19,200
*/
unsigned short int counter=0;
void setup() {
// initialize the serial communication:
Serial.begin(150000);
}
void loop() {
Serial.write(++counter);
}
/*
Processing code
Processing program to count Serial byte reads per second, using the Serial interrupt mechanism.
*/
import processing.serial.*;
Serial myPort;
int oldTime=0,oldCount=0,count=0;
void setup()
{
println("begin");
myPort = new Serial(this, "COM4", 150000);
}
void serialEvent(Serial myPort)
{
count++;
/* print("("+count+")");
print(" : ");
println(myPort.read()); */
}
void draw()
{
if(millis()-oldTime>1000)
{
oldTime=millis();
println("Reads per second: " + (count-oldCount));
oldCount=count;
}
}
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.