| Electronic Components Datasheet Search |
|
AT90SCR100 Datasheet(PDF) 239 Page - ATMEL Corporation |
|
|
|||||||||||||||||||||||||||||
AT90SCR100 Datasheet(HTML) 239 Page - ATMEL Corporation |
|
239 / 433 page ![]() 239 TPR0327AY–SMS–30Jan09 AT90SCR100 18.7.2 Sending Frames with 9 Data Bit If 9-bit characters are used (UCSZ0 = 7), the ninth bit must be written to the TXB8 bit in UCSR0B before the low byte of the character is written to UDR0. The following code examples show a transmit function that handles 9-bit characters. For the assembly code, the data to be sent is assumed to be stored in registers R17:R16. Note: 1. These transmit functions are written to be general functions. They can be optimized if the con- tents of the UCSR0B is static. For example, only the TXB8 bit of the UCSR0B Register is used after initialization. See “About Code Examples” on page 11. The ninth bit can be used for indicating an address frame when using multi processor communi- cation mode or for other protocol handling as for example synchronization. 18.7.3 Transmitter Flags and Interrupts The USART Transmitter has two flags that indicate its state: USART Data Register Empty (UDRE0) and Transmit Complete (TXC0). Both flags can be used to generate interrupts. The Data Register Empty (UDRE0) Flag indicates whether the transmit buffer is ready to receive new data. This bit is set when the transmit buffer is empty, and cleared when the transmit buffer contains data to be transmitted that has not already been moved into the Shift Register. For compatibility with future devices, always write this bit to zero when writing the UCSR0A Register. Assembly Code Example(1) USART_Transmit: ; Wait for empty transmit buffer sbis UCSR0A,UDRE0 rjmp USART_Transmit ; Copy 9th bit from r17 to TXB8 cbi UCSR0B,TXB8 sbrc r17,0 sbi UCSR0B,TXB8 ; Put LSB data (r16) into buffer, sends the data out UDR0,r16 ret C Code Example (1) void USART_Transmit( unsigned int data ) { /* Wait for empty transmit buffer */ while ( !( UCSR0A & (1<<UDRE0))) ) ; /* Copy 9th bit to TXB8 */ UCSR0B &= ~(1<<TXB8); if ( data & 0x0100 ) UCSR0B |= (1<<TXB8); /* Put data into buffer, sends the data */ UDR0 = data; } |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |