[Your IP: 54.164.198.240]
Logowanie

Język: PL EN

KySoft Systemy Informatyczne


sitemap

Computers

amilo-klawiatura
android-config
avr-ioports
avr-uart
avr
buble-lamp
calc-cell-protect
leap-second
mssql
protel-quick-start
usb-camera-problem
xp-problems
(currently only in english)

Control and Status Registers

UCSR0A Bit #NameDescription
bit 7 RXC0 USART Receive Complete. Set when data is available and the data register has not be read yet.
bit 6 TXC0 USART Transmit Complete. Set when all data has transmitted.
bit 5 UDRE0 USART Data Register Empty. Set when the UDR0 register is empty and new data can be transmitted.
bit 4 FE0 Frame Error. Set when next byte in the UDR0 register has a framing error.
bit 3 DOR0 Data OverRun. Set when the UDR0 was not read before the next frame arrived.
bit 2 UPE0 USART Parity Error. Set when next frame in the UDR0 has a parity error.
bit 1 U2X0 USART Double Transmission Speed. When set decreases the bit time by half doubling the speed.
bit 0 MPCM0 Multi-processor Communication Mode. When set incoming data is ignored if no addressing information is provided.

UCSR0B Bit # Name Description
bit 7 RXCIE0 RX Complete Interrupt Enable. Set to allow receive complete interrupts.
bit 6 TXCIE0 TX Complete Interrupt Enable. Set to allow transmission complete interrupts.
bit 5 UDRIE0 USART Data Register Empty Interrupt Enable. Set to allow data register empty interrupts.
bit 4 RXEN0 Receiver Enable. Set to enable receiver.
bit 3 TXEN0 Transmitter enable. Set to enable transmitter.
bit 2 UCSZ20 USART Character Size 0. Used together with UCSZ01 and UCSZ00 to set data frame size. Available sizes are 5-bit (000), 6-bit (001), 7-bit (010), 8-bit (011) and 9-bit (111).
bit 1 RXB80 Receive Data Bit 8. When using 8 bit transmission the 8th bit received.
bit 0 TXB80 Transmit Data Bit 8. When using 8 bit transmission the 8th bit to be submitted.

UCSR0C Bit # Name Description
bit 7
bit 6
UMSEL01
UMSEL00
USART Mode Select 1 and 0. UMSEL01 and UMSEL00 combined select the operating mode. Available modes are asynchronous (00), synchronous (01) and masterSPI (11).
bit 5
bit 4
UPM01
UPM00
USART Parity Mode 1 and 0. UPM01 and UPM00 select the parity. Available modes are none (00), even (10) and odd (11).
bit 3 USBS0 USART Stop Bit Select. Set to select 1 stop bit. Unset to select 2 stop bits.
bit 2
bit 1
UCSZ01
UCSZ00
USART Character Size 1 and 0. Used together with with UCSZ20 to set data frame size. Available sizes are 5-bit (000), 6-bit (001), 7-bit (010), 8-bit (011) and 9-bit (111).
bit 0 UCPOL0 USART Clock Polarity. Set to transmit on falling edge and sample on rising edge. Unset to transmit on rising edge and sample on falling edge.

Timer0 observations

delay(1000)
presc	intr	regs	freq   calc
1/1	9790 RA=83,RB=1	10kHz	16M/1/256=62k NOK (6x za wolno)
1/8	8003 RA=83,RB=2  8kHz	16M/8/256=7812 ok
1/64	982  RA=83,RB=3 980Hz	16M/64/256=976 ok
1/256	245  RA=83,RB=4 245Hz	16M/256/256=244 ok
delay(500) (probably delay loop is not very accurate)
presc	intr	regs	freq   calc
1/1	41039 RA=83,RB=1	16M/1/256/2=32k ok
1/8	4029 RA=83,RB=2  8kHz	16M/8/256/2=7812 ok
1/64	491  RA=83,RB=3 980Hz	16M/64/256/2=976 ok
1/256	122  RA=83,RB=4 245Hz	16M/256/256/2=122 ok

Dodaj komentarz