Hi All,
I'm trying to set up the UART on a ATMega128L. Problem is the output frequency isn't write.
I've got an 8Mhz AVR Clock. The AVR is set up in normal Async mode. UBRR is zero, so the ouput bps should be 0.5MHz (A bit period of 2us). But I'm getting a bit period of (16.5us).
Any ideas? Does Fosc mean the main chip clock?
Thanks All Andy
Here's the code:
.include "m128def.inc"
.def w = R16 ; Define a working register .def data = R17
; Set UBRR for 500kbps ; UBRR = 0
ldi w, 0x00 sts UBRR0H, w
ldi w, 0x00 out UBRR0L, w
; Enable Transmitter ldi w, 1