11.07.2015 Views

ATMega chip full datasheet - UCSD Department of Physics

ATMega chip full datasheet - UCSD Department of Physics

ATMega chip full datasheet - UCSD Department of Physics

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ATmega48A/PA/88A/PA/168A/PA/328/PTable 20-1 contains equations for calculating the baud rate (in bits per second) and for calculatingthe UBRRn value for each mode <strong>of</strong> operation using an internally generated clock source.Table 20-1.Operating ModeEquations for Calculating Baud Rate Register SettingEquation for Calculating BaudRate (1)Equation for CalculatingUBRRn ValueAsynchronous Normal mode(U2Xn = 0)BAUDf= -----------------------------------------OSCUBRRn16( UBRRn + 1)=f----------------------- OSC– 116BAUDAsynchronous Double Speedmode (U2Xn = 1)BAUDf= -------------------------------------- OSCUBRRn8( UBRRn + 1)=f------------------- OSC– 18BAUDSynchronous Master modeBAUDf OSCf= -------------------------------------- UBRRn = ------------------- OSC– 12( UBRRn + 1)2BAUDNote: 1. The baud rate is defined to be the transfer rate in bit per second (bps)BAUD Baud rate (in bits per second, bps)f OSCSystem Oscillator clock frequencyUBRRn Contents <strong>of</strong> the UBRRnH and UBRRnL Registers, (0-4095)Some examples <strong>of</strong> UBRRn values for some system clock frequencies are found in Table (seepage 197).20.3.2 Double Speed Operation (U2Xn)The transfer rate can be doubled by setting the U2Xn bit in UCSRnA. Setting this bit only haseffect for the asynchronous operation. Set this bit to zero when using synchronous operation.Setting this bit will reduce the divisor <strong>of</strong> the baud rate divider from 16 to 8, effectively doublingthe transfer rate for asynchronous communication. Note however that the Receiver will in thiscase only use half the number <strong>of</strong> samples (reduced from 16 to 8) for data sampling and clockrecovery, and therefore a more accurate baud rate setting and system clock are required whenthis mode is used. For the Transmitter, there are no downsides.8271D–AVR–05/11181

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!