Hello,

does any one has a delay table for software serial library for 24MHz? or i need advices on how to calculate the table

Does this help...

i will look and see if it helps

If you find the formulas please let me know!

What do you think about this? (see attachment)

I used excel to get formulas for delays at each baud rate function of frequency and it seems to work

PS: Just noticed a strange value for rxcenter at bauds 31250 and 28800…

SoftwareSerial.xls (78.5 KB)

I like the approach and it will give you good starting numbers.

What you miss is that the numbers in the table are integers which are in fact rounded floats that are corrected for the time the surrounding code takes to execute.

```
for (int i=0; i< 8; i++) // takes some time to compare and increment (looptime)
{
byte += digitalRead(pin) << i; // takes time to do the DR, shift the bit and add it to the byte. (datatime)
microdelay(RXINTRA);
} // takes time to jump to the begin of the loop (jumptime)
```

THEORY: this piece of code in total takes the time 8 bits need, so

RXINTRA = 1/baudrate - (looptime + datatime + jumptime)

In practice it is more complicated as baudrate includes the start and stop bit too. One must find the middle of the bits to read signal level properly.

(from measurement) It takes about 10-12 bits of time to send 8 bits of data, say 11 on average.

finally notice the following structure/ pattern of the table: (for most values)

- RXINTRA == RXSTOP (you noticed)
- TX == RXSTOP -3
- RXCENTER == RXSTOP/2 - somecorrection.

So the thing left is to find a good formula for RXSTOP or RXINTRA.

(this will remove the “strange” values you got from the interpolation)