2021년 11월 11일 목요일

ATxmega-B1 XPLAINED: USART TUTORIAL

 XMEGA USART | Embedded Tutorials (wordpress.com)

































void init_usart()
{
PORTC_DIR|=0x08; //set the direction of PC3 i.e. TXD0 as output and PC2 i.e. RXD0 as input
USARTC0.BAUDCTRLB = 0x60 + (3269 >> 8);
USARTC0_BAUDCTRLA=3269 & 0x00FF;
//USARTC0.BAUDCTRLB = ((0x03 & 0xf0f) >> 0x08);
//USARTC0.BAUDCTRLB |= ((-4 & 0x0F) << 0x04);
//USARTC0_BAUDCTRLA=0xc5;

USARTC0_CTRLB|=USART_RXEN_bm|USART_TXEN_bm; 
USARTC0_CTRLC|=USART_CHSIZE1_bm|USART_CHSIZE0_bm;
USARTC0.CTRLA = USART_RXCINTLVL_LO_gc;
USARTC0.STATUS |= USART_RXCIF_bm; // 0x80  0b10000000
}



댓글 없음:

댓글 쓰기