XMEGA USART receive interrupt routine using ASF

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
I'm having some trouble with AVR studio 6, specifically using their ASF.

I would like to receive a byte via USARTC1 and then set a receive complete flag. After the flag is set I would like to check the received value and if it is an "acceptable" value I would like to perform an event.

Could anyone walk me through this using ASF?
Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ASF isn't a complete solution, it aids in the cross platform migration and compatibility. For example, asf would help in setting up your usart, but doesn't have callbacks associated with interrupts as I'm aware of. I would handle it like:

ISR(USARTC1_RXC_vect)
{
     receiveComplete = true;
     uint8_t data;
     data = USARTC1.DATA;
     if (data == 'C')
     {
          //flash led
     }

}

Or if you were to use ASF

if (usart_rx_is_complete(&USARTC1))
{
     receiveComplete = true;
     uint8_t data;
     data = USARTC1.DATA;
     if (data == 'C')
     {
          //flash led
     }
}

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

is there something like this in the ASF?

[code]while (~USARTC1.STATUS & USART_RXCIF_bm);

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
while(!usart_rx_is_complete(&USARTC1));

Gamu The Killer Narwhal
Portland, OR, US
_________________
Atmel Studio 6.2
Windows 8.1 Pro
Xplained boards mostly