12.07.2015 Views

ATmega32A Datasheet - Sunrom Technologies

ATmega32A Datasheet - Sunrom Technologies

ATmega32A Datasheet - Sunrom Technologies

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ATmega32A</strong>The following code examples show a simple USART transmit function based on polling of theData Register Empty (UDRE) Flag. When using frames with less than eight bits, the most significantbits written to the UDR are ignored. The USART has to be initialized before the functioncan be used. For the assembly code, the data to be sent is assumed to be stored in RegisterR16Assembly Code Example (1)USART_Transmit:; Wait for empty transmit buffersbis UCSRA,UDRErjmp USART_Transmit; Put data (r16) into buffer, sends the dataout UDR,r16retC Code Example (1)void USART_Transmit( unsigned char data ){/* Wait for empty transmit buffer */while ( !( UCSRA & (1

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

Saved successfully!

Ooh no, something went wrong!