Society of Robots - Robot Forum

Software => Software => Topic started by: frank26080115 on February 26, 2008, 11:45:07 PM

Title: No UART? No Problem! Timer Interrupt Based Serial Port
Post by: frank26080115 on February 26, 2008, 11:45:07 PM
I wrote it in the member tutorial page, it doesn't support Rx right now, but it's useful as a debug port.

Can somebody tell me why it works flawlessly for 4800 baud but not 9600?

Time per bit for 9600 baud should be 104.166667 microseconds, counting the timer to 26 should take exactly 104 microseconds.

The error rate should be 0.1%, and I should have about 1664 clock cycles between each bit, shouldn't be that busy... maybe it's only hyperterminal's fault, or my FTDI chip is being a skank...

I just got 9600 baud working, but timer needed to be 24 not 26 like calculated, and at the front of interrupt A I had to add a tiny tiny delay. But now 4800 baud is messed up...