software uart baud rate changes
Posted: Mon May 23, 2011 4:08 pm
I am aware that the preset baud rates don't work with the software uart and the user defined option has to be used to get usable bit times, however there is another strange problem.
If I send a string of up to 31 characters plus crlf via the software uart everything works as expected. Uppercase U is a good character to use as its bits alternate and it is easy to measure the bit time. At 9600 baud this comes out at 104us. If I then send strings of 32 or 33 characters + crlf the terminal screen displays rubbish because the bit time has majically changed to 143us. Strings of 34 and more characters work again as the bit time returns to 104us. I haven't tested to see if the problem recurrs around 64 characters but I wouldn't be surprised if it did.
I noticed this first at 115.2 kbaud and put it down to the high speed but it happens exactly the same way at 9600.
I am using an 18F4620 @ 40MHz. Any ideas?
Thanks,
Brian Walsh
If I send a string of up to 31 characters plus crlf via the software uart everything works as expected. Uppercase U is a good character to use as its bits alternate and it is easy to measure the bit time. At 9600 baud this comes out at 104us. If I then send strings of 32 or 33 characters + crlf the terminal screen displays rubbish because the bit time has majically changed to 143us. Strings of 34 and more characters work again as the bit time returns to 104us. I haven't tested to see if the problem recurrs around 64 characters but I wouldn't be surprised if it did.
I noticed this first at 115.2 kbaud and put it down to the high speed but it happens exactly the same way at 9600.
I am using an 18F4620 @ 40MHz. Any ideas?
Thanks,
Brian Walsh